I am using this .htaccess code for my website
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.website.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([^.]+).website.com$ [NC]
RewriteRule ^$ /application/index.php [L]
This checks for subdomain other than www and displays content from directory /www/application
But the problem is for the first time it works correctly and displays the correct page but when i redirect internally/go to other page it loads the content from /www/
directory and not from /www/application/
directory.
And it also shows application
in the url parameter which i want to get rid of.
Ex : url = http://stackoverflow.website.com/application/user.php
I want it to be like url = http://stackoverflow.website.com/user.php
- but from application directory.开发者_运维问答
Need this for a SAAS Application.
The most obvious problem with your rule is that rule is that it will only apply to the root of the domain, because of the ^$
rule. Your probably want to replace that line with something like this:
RewriteRule ^(.*)$ application/$1 [L]
That will match any URL and divert it to the same URL in your application directory. You might need to add the QSA
flag to make your app work.
I'd think the problem with "/application/" showing up in your URLs is down to the configuration of the software itself, and how it generates URLs internally. See if it has a config parameter to change its external URL.
精彩评论