Simple URL rewrite cuasing querystring rewrite issues?
2 posts
• Page 1 of 1
Simple URL rewrite cuasing querystring rewrite issues?
Hi there,
I am using the full version of ISAPI Rewrite 64 bit and I am hoping someone can help with me the following;
I have a number of rules set up that seem to be working OK (see below):
What I would like is to do the following:
1) Re-write "/news.asp" (no querystring values) to "/news/" and also include the reverse rule?
I have already tried (see code below), but it stops the rule above working?
How do I apply this simple rule without it affecting the one with querystring values in it?
2) I also want to rewrite the following URLs, NOT redirect?
/collection.asp?SpeciesID=123 --> /snakes
/collection.asp?SpeciesID=234 --> /spiders
Many thanks for help on this
Simon (Clearchannel)
I am using the full version of ISAPI Rewrite 64 bit and I am hoping someone can help with me the following;
I have a number of rules set up that seem to be working OK (see below):
- Code: Select all
RewriteBase /
RewriteCond %{REQUEST_METHOD} !^POST
RewriteCond %{QUERY_STRING} ^Headline=([^=&]+)&NewsID=([^=&]+)$
RewriteRule ^news\.asp$ news/%1/%2/? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^news/([^/]+)/([^/]+)/?$ news.asp?Headline=$1&NewsID=$2 [NC,L]
What I would like is to do the following:
1) Re-write "/news.asp" (no querystring values) to "/news/" and also include the reverse rule?
I have already tried (see code below), but it stops the rule above working?
- Code: Select all
RewriteRule ^news\.asp$ /news [NC,R=301,L]
RewriteRule ^news/?$ news.asp? [NC,L]
How do I apply this simple rule without it affecting the one with querystring values in it?
2) I also want to rewrite the following URLs, NOT redirect?
/collection.asp?SpeciesID=123 --> /snakes
/collection.asp?SpeciesID=234 --> /spiders
Many thanks for help on this
Simon (Clearchannel)
Re: Simple URL rewrite cuasing querystring rewrite issues?
The following config should work without issues:
RewriteBase /
RewriteCond %{REQUEST_METHOD} !^POST
RewriteCond %{QUERY_STRING} ^Headline=([^=&]+)&NewsID=([^=&]+)$ [NC]
RewriteRule ^news\.asp$ news/%1/%2/? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^news/([^/]+)/([^/]+)/?$ news.asp?Headline=$1&NewsID=$2 [NC,L]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^news\.asp$ /news/ [NC,R=301,L]
RewriteRule ^news/?$ news.asp [NC,L]
RewriteCond %{QUERY_STRING} ^SpeciesID=123$ [NC]
RewriteRule ^collection\.asp /snakes [NC,L]
RewriteCond %{QUERY_STRING} ^SpeciesID=124$ [NC]
RewriteRule ^collection\.asp /spiders [NC,L]
RewriteBase /
RewriteCond %{REQUEST_METHOD} !^POST
RewriteCond %{QUERY_STRING} ^Headline=([^=&]+)&NewsID=([^=&]+)$ [NC]
RewriteRule ^news\.asp$ news/%1/%2/? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^news/([^/]+)/([^/]+)/?$ news.asp?Headline=$1&NewsID=$2 [NC,L]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^news\.asp$ /news/ [NC,R=301,L]
RewriteRule ^news/?$ news.asp [NC,L]
RewriteCond %{QUERY_STRING} ^SpeciesID=123$ [NC]
RewriteRule ^collection\.asp /snakes [NC,L]
RewriteCond %{QUERY_STRING} ^SpeciesID=124$ [NC]
RewriteRule ^collection\.asp /spiders [NC,L]
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 24 guests