我的htaccess文件在服务器上有问题。当尝试将http重定向到https时,它变得疯狂。
如果我这样做:
ErrorDocument 400 /errores/error400.php
ErrorDocument 404 /errores/error404.php
ErrorDocument 403 /errores/error403.php
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([A-Za-z0-9_-]+)$ /index.php?lang=$1
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ /index.php?lang=$1&go=$2
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ /index.php?lang=$1&go=$2&action=$3它工作正常,只是没有将http重定向到https。
但是当我这样说的时候:
ErrorDocument 400 /errores/error400.php
ErrorDocument 404 /errores/error404.php
ErrorDocument 403 /errores/error403.php
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule ^([A-Za-z0-9_-]+)$ /index.php?lang=$1
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ /index.php?lang=$1&go=$2
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ /index.php?lang=$1&go=$2&action=$3服务器重定向到https,但它使用https://server.com/folder1/folder2/web/portal/en/home而不是像https://server.com/en/home那样放置url
我不知道该怎么做。
提前感谢
发布于 2014-10-17 02:17:14
我建议您将重写规则与标志相匹配,尤其是对于HTTPS重定向。
以下是适用于我的生产服务器的方法:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]当您放入L时,它会告诉apache停止处理以下规则,这些规则也与(.*)匹配。您可以在此处找到有关该标志的更多信息:RewriteRule Flags
https://stackoverflow.com/questions/26410901
复制相似问题