ReWrite a URL and then ReWrite it again?
3 posts
• Page 1 of 1
ReWrite a URL and then ReWrite it again?
I'm trying to rewrite page to another page, but that page also has to be rewritten to a more friendly URL. There has to be a better way to do this. What I have right now isn't working. I'm sure it's something small. Anyone's help would be much appreciated.
The first line is rewriting the current URL to the new "friendly" URL (doesn't work). The second line is designed to rewrite the friendly URL displaying the files in the second part of the line. The second line DOES work by itself.
Again, I'm sure it's very simple or maybe there is a a flat better way to do it.
Thanks in advance for your assistance.
- Code: Select all
RewriteRule index.cfm?areaCat=events /stealsanddeals/events/ [R=301,NC,L,NS]
RewriteRule ^stealsanddeals/events/?$ events.cfm?areaCat=upcomingevents [NC,L,NS]
The first line is rewriting the current URL to the new "friendly" URL (doesn't work). The second line is designed to rewrite the friendly URL displaying the files in the second part of the line. The second line DOES work by itself.
Again, I'm sure it's very simple or maybe there is a a flat better way to do it.
Thanks in advance for your assistance.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: ReWrite a URL and then ReWrite it again?
Hello,
Yes, it is small.
Try to replace the first rule with:
Probably, you also do not need to use NS flag.
Regards
Andrew
Yes, it is small.
Try to replace the first rule with:
- Code: Select all
RewriteCond %{QUERY_STRING} ^areaCat=events$ [NC]
RewriteRule ^index\.cfm /stealsanddeals/events/ [R=301,NC,L]
Probably, you also do not need to use NS flag.
Regards
Andrew
Re: ReWrite a URL and then ReWrite it again?
Excellent. I knew it was something simple. I did append a ? to the end of the RewriteRule as it was still tossing the querystring on the back of the new URL
domain.com/stealsanddeals/events/?areaCat=events
So, by changing it to the following:
I got the following which was exactly what I was looking for:
domain.com/stealsanddeals/events/
Thanks so much for the quick help! You rock.
Great product guys!
domain.com/stealsanddeals/events/?areaCat=events
So, by changing it to the following:
RewriteCond %{QUERY_STRING} ^areaCat=events$ [NC]
RewriteRule ^index\.cfm /stealsanddeals/events/? [R=301,NC,L]
I got the following which was exactly what I was looking for:
domain.com/stealsanddeals/events/
Thanks so much for the quick help! You rock.
Great product guys!
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 19 guests