-1
我需要将两个重写条件合并成一个我发现搜索网络的条件。问题是,如果一个作品其他的不会:需要帮助在.htaccess中使用mod_rewrite合并两个重写规则
### [RULE1: remove the .php at end of file/url]
# If requested URL-path plus ".php" exists as a file
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
# Rewrite to append ".php" to extensionless URL-path
RewriteRule ^(([^/]+/)*[^.]+)$ /$1.php [L]
而且
### [RULE2: http to https redirection]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST}
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
显然,无论规则被放置在顶级作品。
所以我需要一种方法来删除在url结尾处的php扩展,但是如果url包含http而不是https,它也应该自动重定向到https版本的脚本。
任何帮助将不胜感激!
工程就像一个魅力。谢谢! – user1212150 2012-02-16 11:46:16
@ user1212150欢迎。请接受答案,以便Q/A将被关闭。 – ThinkingMonkey 2012-02-16 11:54:09