htaccess在本地主机上工作,但在GoDaddy中没有

时间:2019-02-24 19:22:54

标签: php .htaccess hosting

经过长时间的搜索,我终于用我需要的规则创建了一个htaccess文件。在本地主机上,一切正常,但在GoDaddy主机上,只有一半规则有效……有人遇到同样的问题或知道如何解决吗?谢谢

# THIS IS NOT WORKING / Returns a page not found error
RewriteEngine On
RewriteRule ^/?customize/?$ all_poi.php
RewriteRule ^/?santorini/?$ santorini.php
RewriteRule ^/?aboutus/?$ aboutus.php
RewriteRule ^/??tours/?$ all_tours.php
RewriteRule ^/?tours/([0-9]+) tours.php?tour_id=$1& [L]


# Redirects to https / WORKING
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?mywebsite\.com
RewriteRule ^(.*)$ https://www.mywebsite.com/$1  [R=301,L]

#remove trailing slash / WORKING
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301] # <- for test, for prod use [L,R=301]

# Removes index.php from ExpressionEngine URLs / WORKING
RewriteEngine On
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

0 个答案:

没有答案