Topic: 301 redirect for query-string
|

|
| Author |
|
willem Newbie

Joined: 07 April 2009
Online Status: Offline Posts: 5
|
| Posted: 13 June 2010 at 11:12am | IP Logged
|
|
|
Hello, I try to make this htaccess work in ISAPI 2 I want a 301 redirect for every query-string in the site except for mydir where the query-string should work
example : index.php?id=45 to index.php This is the htaccess : RewriteCond $1 !mydir/ RewriteCond %{QUERY_STRING} . RewriteRule (.*) http://www.mysite.com/$1? [R=301]
Some help please!!!
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Online Posts: 10489
|
| Posted: 14 June 2010 at 5:02am | IP Logged
|
|
|
Firstly, ISAPI_Rewrite v2 operates httpd.ini files not .htaccess.
Secondly, the syntax is different:
[ISAPI_Rewrite]
RewriteRule /(?!mydir/.*)(.*)\?.+ http\://www.mysite.com/$1 [I,RP]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
willem Newbie

Joined: 07 April 2009
Online Status: Offline Posts: 5
|
| Posted: 14 June 2010 at 6:21am | IP Logged
|
|
|
Thanks Anton, this works perfect.
Is there a reason why you write http\://www.mysite.com/$1 instead of /$1 because it seems to do exactly the same.
How do I have to write the first bit if I want to exclude more than one directory, for instance : !dir1|!dir2|!dir3 I tried a few combinations, but it always breaks the rule...
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Online Posts: 10489
|
| Posted: 14 June 2010 at 8:05am | IP Logged
|
|
|
"Is there a reason why you write http\://www.mysite.com/$1 instead of /$1 because it seems to do exactly the same."
- the correct syntax for 201 redirect in ISAPI_Rewrite 2 requires fully qualified path.
"How do I have to write the first bit if I want to exclude more than one directory"
- Here's how it should be:
RewriteRule /(?!(?:dir1|dir2|dir3)/.*)(.*)\?.+ http\://www.mysite.com/$1 [I,RP]
__________________ Regards,
Anton
|
| Back to Top |
|
| |
willem Newbie

Joined: 07 April 2009
Online Status: Offline Posts: 5
|
| Posted: 14 June 2010 at 9:07am | IP Logged
|
|
|
Thanks a lot Anton
Cheers, Willem
|
| Back to Top |
|
| |
|
|
If you wish to post a reply to this topic you must first login
If you are not already registered you must first register
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum
|