Note that there are some explanatory texts on larger screens.

plurals
  1. PORewriteRule violates while switching from https to http
    primarykey
    data
    text
    <p>I write a lot of <strong>RewriteRule</strong> in my <code>.htaccess</code> file , but problem occurs when I switch from <strong>https</strong> to <strong>http</strong> pages; it does not follow these rules </p> <p><strong>NOTE :</strong> everything working fine on localhost , issues are on server &lt;---- <strong>UPDATE</strong></p> <p>Here is my <a href="http://www.charityrummage.com" rel="nofollow">website </a>, currently all links display as per <strong>RewriteRule*</strong> </p> <p>for e.g. <strong>about us</strong> page link display as</p> <pre><code>http://www.mywebsite.com/about </code></pre> <p><strong>BUT</strong> </p> <p>if I am at <a href="https://www.charityrummage.com/login" rel="nofollow"><code>login page</code></a> ( which is on <code>https</code> ) and click on <strong>about us</strong> page then it turns into below.</p> <pre><code>http://www.mywebsite.com/about?slug=about_us </code></pre> <p>or if I click on any category on left panel then it comes as</p> <pre><code>http://www.mywebsite.com/auction/category/1?cid=1 </code></pre> <p><strong>Note :</strong> even mouse hovering on pages display rewrite link</p> <p>below is <code>.htaccess</code> file with needed information.</p> <pre><code>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] </code></pre> <p><em>Note :</em> <a href="http://pastebin.com/YPiehZq1" rel="nofollow"><code>Here</code></a> is complete <code>.htaccess</code> file </p> <p>Please tell me where I am wrong/missing ?</p> <p>I Also have few more confusion</p> <ul> <li>If i change the case of rewrite URL ( <strong>Login or lOgin or logiN</strong> ) then it gives error?</li> <li>Is it good practice to write <strong>[NC,L]</strong> with all <code>RewriteRule</code>?</li> <li>Exactly when I should write <strong>[QSA]</strong> ?</li> </ul> <hr> <h1>UPDATE</h1> <p>After suggestions from all answers, <strong>changing in <code>RewriteRule</code> almost fixed all issue</strong> but now there is one last issue.</p> <ul> <li><code>/login</code> URL always changed into <code>/login.php</code>.</li> </ul> <p>below is my updated <strong>.htaccess</strong></p> <pre><code>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 &lt;IfModule mod_rewrite.c&gt; RewriteCond %{HTTPS} off RewriteRule ^(.*).css$ /csszip.php?file=$1.css [L] &lt;/IfModule&gt; #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 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload