ok i am having a problem with redirection on apache, i have a domain configured on my hostin开发者_运维问答g account but the domain needs to be redirected to a folder. eg: / is root of server where the mysite.com answers /mysite is where the files are so i got this htaccess code to do the job:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !^/mysite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /mysite/$1
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^(/)?$ mysite/index.php [L]
plus i made an index.php to redirect to mysite folder. everything seems to be working good the only problem is i added a forum on /mysite/forums/ and for some reason instead of getting mysite.com/forums/ in the browser im getting mysite.com/mysite/forums/
could anyone help me solve this problem? Thanks in advance!
I would try writing the full address, so something like:
RewriteRule ^(.*)$ http://www.site.com/$1
and
RewriteRule ^(/)?$ http://www.site.com/index.php [L]
ok i got what was wrong and i thank everyone that had a look at it.
Solution: Change last line
RewriteRule ^(/)?$ mysite/index.php [L]
to
RewriteRule ^(/)?$ mysite/$1 [L]
so it answer to anything coming from that folder not just the index.php :)
精彩评论