[英]php .htacess redirect non www to www url not working
我想將非www重定向到www url,除了可以正常工作外
http://wellnessvisit.com/blog/
我想重定向到
http://www.wellnessvisit.com/blog/
雖然它可以在所有其他網址上正常工作,但不適用於此
以下是我的.htaccess
文件
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php
RewriteRule ^index\.php$ / [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule doctor-(.*)\.htm$ doctor-details.php?doc_id=$1
RewriteRule hospital-(.*)\.htm$ hospital_detail.php?hosp_spec_id=$1
RewriteRule hotel-(.*)\.htm$ hotel_details.php?hotel_id=$1
RewriteRule destination-(.*)\.htm$ destination_details.php?dest_id=$1
RewriteRule news-(.*)\.htm$ news-details.php?news_id=$1
RewriteRule article-(.*)\.htm$ articles-details.php?article=$1
RewriteRule service-(.*)\.htm$ service-details.php?service_id=$1
RewriteRule user-register.php$ register.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]
#adds ".php" to a URL that isn't a directory or a file
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*)$ $1.php
當我單擊http://wellnessvisit.com/blog/時 ,它會將我重定向到http://www.wellnessvisit.com/blog/ 。 因此,htaccess規則似乎運行良好。
您可能遇到的問題可能是由於緩存的重定向,請在其他瀏覽器中嘗試上述鏈接,或者嘗試清除瀏覽器的緩存。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.