【发布时间】:2014-06-13 17:20:53
【问题描述】:
我的主帐户 (main.com) 上有一个插件域 (addon.com)。大多数文件都可以正常工作,例如 html 文件将转到插件域 (addon.com/test.html)。但是,PHP 文件重定向到主域的子文件夹。例如,我将 test.php 放在 addon.com 的文件夹中,当我在浏览器中访问它时,它会重定向到
main.com/addon.com/test.php
而不是
addon.com/test.php
这是我需要在我的 .htaccess 中设置的东西吗?下面是 public_html 主目录中的 .htaccess 文件。顺便说一句,我正在使用 hostgator 作为主机。
.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://dailydoge.com/$1 [R=301,L]
# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ http://dailydoge.com/$1 [R=301,L]
# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
</IfModule>
【问题讨论】:
-
/addon.com/文件夹中是否有任何 .htaccess?
标签: php .htaccess redirect shared-hosting