RewriteRule se infringe al cambiar de https a http
Escribo mucho deReescribir en mi.htaccess
archivo, pero el problema se produce cuando cambio dehttps ahttp páginas; no sigue estas reglas
NOTA : todo funciona bien en localhost, los problemas están en el servidor <----ACTUALIZAR
Aquí está misitio web, actualmente todos los enlaces se muestran segúnRewriteRule *
por ejemplosobre nosotros enlace de página se muestra como
http://www.mywebsite.com/about
PERO
si estoy enlogin page
(que está enhttps
) y haga clic ensobre nosotros La página entonces se convierte en abajo.
http://www.mywebsite.com/about?slug=about_us
o si hago clic en cualquier categoría en el panel izquierdo, aparece como
http://www.mywebsite.com/auction/category/1?cid=1
Nota : incluso el mouse sobre las páginas muestra el enlace de reescritura
a continuación es.htaccess
archivo con la información necesaria.
IndexIgnore *
RewriteEngine on
Options +FollowSymLinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^auction/category/([0-9]+)/?$ bids.php?cid=$1 [NC]
RewriteRule ^login/?$ login.php [NC]
RewriteRule ^register/?$ register.php [NC]
RewriteRule ^logout/?$ logout.php [NC]
# static pages
RewriteRule ^about/?$ page.php?slug=about_us [NC]
# Rewrite to https
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /login [OR]
RewriteCond %{REQUEST_URI} /do_login.php
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L,QSA]
# don't do anything for images/css/js (leave protocol as is)
RewriteRule \.(gif|jpe?g|png|ico|css|js)$ - [NC,L]
# traffic to http:// except some pages
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(/login|/do_login.php)
RewriteRule ^(.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L,QSA]
Nota : Here
Esta completo.htaccess
expediente
Por favor, dime dónde estoy equivocado / perdido?
También tengo un poco más de confusión
Si cambio el caso de reescribir URL (Login o lOgin o logiN ) entonces da error?¿Es buena práctica escribir[NC, L] con todaRewriteRule
?Exactamente cuando debería escribir[QSA] ?ACTUALIZARDespués de sugerencias de todas las respuestas,cambiando enRewriteRule
casi arreglado todo problema Pero ahora hay un último tema.
/login
URL siempre cambió a/login.php
.debajo esta mi actualizada.htaccess
IndexIgnore *
Options -MultiViews
Options +FollowSymLinks
#mod_rewrite
RewriteEngine on
RewriteBase /
# Rewrite www to non www
RewriteCond %{HTTP_HOST} ^www.%{HTTP_HOST} [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
# minimize the css on all http:// pages
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} off
RewriteRule ^(.*).css$ /csszip.php?file=$1.css [L]
</IfModule>
#switch over http to https
# Rewrite to https
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (/login|/do_login)\.php [NC]
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# don't do anything for images/css/js (leave protocol as is)
RewriteRule \.(gif|jpe?g|png|ico|css|js)$ - [NC,L]
# traffic to http:// except some pages
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(/login|/do_login)\.php [NC]
RewriteRule ^(.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^login/?$ login.php [NC]
RewriteRule ^register/?$ register.php [NC]
# ...many other rules...with [NC] falg
RewriteRule ^auction/category/([^/.]+)/?$ bids.php?cid=$1 [NC]
RewriteRule ^about/?$ page.php?slug=about_us [NC]
# ...many more rules.... with [NC] flag