【发布时间】:2014-02-01 09:20:46
【问题描述】:
我有 2 个网站:一个站点位于公共 html 文件夹的根目录中,另一个站点位于 WFM 子文件夹中,WFM 子文件夹面临一些问题,即无法重定向到正确的页面而不是显示内容在 domain.com.sg/careers 中,它正在重新加载 主页。
奇怪的是图像,JS 和 CSS 返回 200 OK,尽管文件包含 index.php 的内容。通过 Google Chrome 网络开发者工具测试。
domain.com.sg 只是一个虚拟网址。
/home/webfire/public_html/.htaccess 上的代码
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
IndexIgnore *
Options All -Indexes
IndexOptions +SuppressHTMLPreamble
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com.sg #Not working correctly
RewriteCond %{REQUEST_URI} !^/wfm #Not working correctly
RewriteRule ^(.*)$ /wfm/$1 [L] #Not working correctly
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f #For website located in the public_html folder
RewriteCond %{REQUEST_FILENAME} !-d #For website located in the public_html folder
RewriteRule ^(.*)$ index.php/$1/ [L] #For website located in the public_html folder
RewriteCond %{REQUEST_METHOD} ^PUT$ [OR]
RewriteCond %{REQUEST_METHOD} ^MOVE$
RewriteRule ^/files/(.*)\.php /files/$1.nophp
RewriteCond %{HTTP_REFERER} !^http://domain.com.sg/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://domain.com.sg$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com.sg/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com.sg$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
【问题讨论】:
标签: php regex apache .htaccess mod-rewrite