【发布时间】:2018-04-29 03:57:22
【问题描述】:
我确定这个问题之前已经提出过,但我真的不知道要搜索什么。
当我单击该站点的外部链接时,我的 .htaccess 文件似乎正在删除“/”。 例如,当我点击“www.mysite.com/home”时,我会被定向到“www.mysite.comhome”
这是我的 .htaccess
# Turn mod_rewrite on
Allow from all
RewriteEngine On
Options +FollowSymLinks -MultiViews
ErrorDocument 404 /errors/404.php
DirectoryIndex home.php
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]
# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{REQUEST_URI} ^(.*?)(/{2,})(.*)$
RewriteRule . %1/%3 [R=301,L]
再次感谢!!
【问题讨论】:
标签: php html .htaccess redirect