【发布时间】:2014-11-08 02:43:56
【问题描述】:
我有一个站点需要从 apache2 迁移到 nginx,一切正常,除了 htaccess。我有谷歌一些在线工具(http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ & http://winginx.com/en/htaccess ...),但它们都不起作用,即使是一条规则:(!
谁能帮帮我,谢谢!!!
<IfModule mod_rewrite.c>
RewriteEngine on
#First rewrite any request to the wrong domain to use the correct one (here www.)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#Now, rewrite to HTTPS:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^/index.php$
RewriteRule . /index.php [L]
</IfModule>
<IfModule mod_php5.c>
php_flag magic_quotes_gpc off
php_flag magic_quotes_runtime off
</IfModule>
<IfModule mod_php4.c>
php_flag magic_quotes_gpc off
php_flag magic_quotes_runtime off
</IfModule>
【问题讨论】:
-
哎呀,请不要这样,检查stackoverflow.com/questions/14927184/…。同样,这是一个 try_files 案例,而不是重写。
标签: apache .htaccess mod-rewrite nginx