2 rewrites - 1 overrides the other
4 posts
• Page 1 of 1
2 rewrites - 1 overrides the other
Hi
I have the following rewrite in place - however the first rule is always used. How do I get the second rule to work?
RewriteCond %{QUERY_STRING} ^p=([^&]+)&title=(.*)$
Rewriterule ^inner\.asp$ /%1/%2? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ /inner.asp?p=$1&title=$2 [NC,L]
RewriteCond %{QUERY_STRING} ^p=([^&]+)&title=(.*)$
Rewriterule ^area\.asp$ /%1/%2? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ /are.asp?p=$1&title=$2 [NC,L]
I have the following rewrite in place - however the first rule is always used. How do I get the second rule to work?
RewriteCond %{QUERY_STRING} ^p=([^&]+)&title=(.*)$
Rewriterule ^inner\.asp$ /%1/%2? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ /inner.asp?p=$1&title=$2 [NC,L]
RewriteCond %{QUERY_STRING} ^p=([^&]+)&title=(.*)$
Rewriterule ^area\.asp$ /%1/%2? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ /are.asp?p=$1&title=$2 [NC,L]
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: 2 rewrites - 1 overrides the other
Well, as you can see you have 2 sets or rules. 2 rules in each.
The second rule's pattern of each set is exactly the same - ^([^/]+)/([^/]+)$.
So the first set will always work, while second will perform only the first rule, not second.
I'd suggest using the following set of rules:
Regards
Andrew
The second rule's pattern of each set is exactly the same - ^([^/]+)/([^/]+)$.
So the first set will always work, while second will perform only the first rule, not second.
I'd suggest using the following set of rules:
- Code: Select all
RewriteCond %{QUERY_STRING} ^p=([^&]+)&title=(.*)$
Rewriterule ^inner\.asp$ /i/%1/%2? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^i/([^/]+)/([^/]+)$ /inner.asp?p=$1&title=$2 [NC,L]
RewriteCond %{QUERY_STRING} ^p=([^&]+)&title=(.*)$
Rewriterule ^area\.asp$ /a/%1/%2? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^a/([^/]+)/([^/]+)$ /are.asp?p=$1&title=$2 [NC,L]
Regards
Andrew
- suntattood
- Posts: 27
- Joined: 04 Dec 2012, 21:06
Re: 2 rewrites - 1 overrides the other
Does this depend on the file name you used?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: 2 rewrites - 1 overrides the other
Of course, you'll have to adjust it for your personal needs.
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 45 guests