友好网址的Rerite规则 - 不工作

时间:2014-07-03 16:51:55

标签: php .htaccess mod-rewrite rewrite

我正在尝试将/healthcare.php简化为/ healthcare,将global_total_office.php简化为/ global

我相信我已经遵循了所有正确的RewriteEngine指令,但是当我转到缩短的URL时,我只得到一个空白的白页。请帮忙!

这是.htaccess文件的完整RewriteEngine部分:

RewriteEngine on

#rewrite rules for friendly urls
RewriteRule    ^healthcare/?$    /healthcare.php    [R=301,NC,L]
RewriteRule    ^global/?$    /global_total_office.php    [R=301,NC,L]

#make sure admin area continues to go to admin area
RewriteRule ^admin/(.*)$ admin/$1 [QSA,L]

#make sure utilities links go directly to utilities
RewriteRule ^utilities/(.*)$ utilities/$1 [QSA,L]

RewriteCond %{HTTP_USER_AGENT} ^Googlebot
RewriteRule ^(.*)$ /utilities/ajax_crawl/crawl.php [QSA,L]
RewriteCond %{HTTP_USER_AGENT} ^bingbot
RewriteRule ^(.*)$ /utilities/ajax_crawl/crawl.php [QSA,L]
RewriteCond %{HTTP_USER_AGENT} ^facebookexternalhit
RewriteRule ^(.*)$ /utilities/ajax_crawl/crawl.php [QSA,L]
RewriteCond %{HTTP_USER_AGENT} ^LinkedInBot
RewriteRule ^(.*)$ /utilities/ajax_crawl/crawl.php [QSA,L]

#rule for doing ajax crawling
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$
RewriteRule ^(.*)$ /utilities/ajax_crawl/crawl.php [QSA,L]

#redirect a default page request to index.php
RewriteRule ^$ %{DOCUMENT_ROOT}/sitearea/mainnew/index.php [QSA,L]

#redirect a subdirectory default page request to index.php
RewriteCond %{DOCUMENT_ROOT}/sitearea/mainnew/$1 -d
RewriteRule (.+) /sitearea/mainsite/$1/index.php [QSA,L]

#redirect any page request to sitearea/mainnew first
RewriteCond %{DOCUMENT_ROOT}/sitearea/mainnew%{REQUEST_URI} -f
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/sitearea/mainnew%{REQUEST_URI} [QSA,L]

#if page isn't found in sitearea/mainnew then just try sitearea
RewriteCond %{DOCUMENT_ROOT}/sitearea%{REQUEST_URI} -f
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/sitearea%{REQUEST_URI} [QSA,L]

#redirect a subdirectory default page request to index.php
RewriteCond %{DOCUMENT_ROOT}/sitearea/$1 -d
RewriteRule (.+) /sitearea/$1/index.php [QSA,L]

#our 404 catch all page that can be used for friendly urls
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule (.*) /utilities/404.php?path=$1 [QSA,L]

0 个答案:

没有答案