HTTPS requests redirect to HTTP

Discuss practical ways rearrange URLs using mod_rewrite.

HTTPS requests redirect to HTTP

Postby km1336 » Sun Aug 31, 2008 10:31 am

Hi,

In the httpd-ssl.conf file I have this RewitreRule and it works fine for the HTTPS requests:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*?)\.php&clue=([^&]+)$
RewriteRule ^/List/$ /List/%1\.php?clue=%2 [R]

But i want that rule redirects to http.
How can I write a rule that after applying these rules, redirect HTTPS to HTTP?

I changed the last line to:

RewriteRule ^/List/$ http://mydomain/List/%1\.php?clue=%2 [R]

It did not work.

Thanks for your help.



mk
km1336
 
Posts: 4
Joined: Wed Aug 27, 2008 9:23 pm

Postby km1336 » Sun Aug 31, 2008 12:20 pm

I solved. I changed [R] to [R=301]
RewriteRule ^/List/$ http://mydomain/List/%1\.php?clue=%2 [R=301]
mk
km1336
 
Posts: 4
Joined: Wed Aug 27, 2008 9:23 pm

Postby richardk » Tue Sep 02, 2008 11:38 am

You shouldn't escape "."s in the substitution part of the RewriteRule. You should use the L flag to stop processing.
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^/List/$ http://www.example.com/List/%1.php?clue=%2 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 20 guests

cron