HTTP到HTTPS重写并将请求传递到$1.php
我不能让它工作 在我使用HTTPS之前,我有:HTTP到HTTPS重写并将请求传递到$1.php,php,apache,.htaccess,mod-rewrite,url-rewriting,Php,Apache,.htaccess,Mod Rewrite,Url Rewriting,我不能让它工作 在我使用HTTPS之前,我有: RewriteRule^(.*)$/$1.php 简单。请求/page/成为/page.php 我添加了HTTPS: RewriteRule(.*)https://%{HTTP\u HOST}%{REQUEST\u URI} 这很有效。但是我无法使/page/到/page.php的行为与我尝试创建的任何规则一起工作: RewriteRule(.*)https://%{HTTP\u HOST}%{REQUEST\u URI}.php RewriteR
RewriteRule^(.*)$/$1.php
简单。请求/page/
成为/page.php
我添加了HTTPS:
RewriteRule(.*)https://%{HTTP\u HOST}%{REQUEST\u URI}
这很有效。但是我无法使/page/
到/page.php
的行为与我尝试创建的任何规则一起工作:
RewriteRule(.*)https://%{HTTP\u HOST}%{REQUEST\u URI}.php
RewriteRule(.*)https://%{HTTP_HOST}/$1.php
RewriteRule(.*)https://%{HTTP_HOST}$1.php
RewriteRule(.*)https://%{SERVER_NAME}/$1.php
RewriteRule(.*)https://%{SERVER_NAME}/%$1.php
我不知道如何让HTTP重写在HTTPS上工作
编辑:
.htaccess
DirectoryIndex.php
重新启动发动机
重写cond%{HTTPS}!在…上
重写规则(*)https://%{HTTP_HOST}$1.php
谢谢你的帮助 您应该使用两种不同的规则:
DirectoryIndex index.php
RewriteEngine On
# redirect http to https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=301]
# add .php internally
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
您能否展示您的完整.htaccess,并阐明您所说的
有效的含义。但是我无法让.php文件加载任何mmore
?添加到帖子中,谢谢。“但是我无法让/page/to/page.php行为与我试图创建的任何规则一起工作:”这是WordPress网站吗?