Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite combine rules

         

TheNut

7:06 pm on Jun 22, 2010 (gmt 0)

10+ Year Member


Hey guys I've read a lot on this site and I just want to thank you for all the help I've gotten from just reading posts...

I just recently updated parts of my site to be secure. Some users of my site have old things bookmarked so if they try to request http://domain.com/jira/something I want them to be redirected to https://domain.com/jira
(I dont care about the deeplinks, they can just start over) I have the following but want to combine the rewrite rule.

RewriteCond %{REQUEST_URI} jira/(.*)
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.something.com/jira [L,R=301]

RewriteCond %{REQUEST_URI} newjira/(.*)
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.something.com/newjira [L,R=301]

I changed my rewrite condition to

RewriteCond %{REQUEST_URI} ((/newjira/(.*)|(/jira/(.*)))

but I'm having trouble with the rewrite rule I cant figure out how to just append /jira I keep getting /jira/something

Thank you

jdMorgan

8:57 pm on Jun 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The First RewriteCond is redundant, as the requested URL-path can be tested in the RewriteRule itself:

RewriteCond %{HTTPS} =off
RewriteRule ^((new)?jira)(/.*)?$ https://www.something.com/$1/ [L,R=301]

Jim

TheNut

1:03 pm on Jun 23, 2010 (gmt 0)

10+ Year Member



Thank you for your help... I just tested it and that's exactly what I needed. Thanks again