I have the following rewrite rule for domain to load from a folder. The problem that I am having when I try to go to http://www.mydomainfolder.com/somerfolder
then it redirect and shows "mydomainfolder" in the address ( http://www.mydomainfolder.com/mydomainfolder/somefolder/index.php
) but if add trailing slash ( http://www.mydomainfolder.com/somerfolder/
) then it doesn't show the mydomainfodler in the address. What I am doing wrong here. Please help!!
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)?smydomain.com$
RewriteCond %{REQUEST_URI} !^/mydomainfolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /mydomainfolder/$1
RewriteCond %{HTTP_HOST} ^(.*)?mydomain.com$
RewriteRule ^(/)?$ /mydomainfolder/$1/index.php [L]
Replace your rules with:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} mydomain\.com$
RewriteRule ^/?$ /mydomainfolder/index.php [L]
RewriteCond %{HTTP_HOST} mydomain\.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/mydomainfolder
RewriteRule ^(.*?)/?$ /mydomainfolder/$1/ [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.