Simple Query String Question
2 posts
• Page 1 of 1
Simple Query String Question
Hello,
I am trying to rewrite an expresion like this:
domainname/cgi-bin/demo/dir1/?var1=value1&var2=value2
into something like:
domainname/dir1/?var1=value1&var2=value2
I have this:
RewriteCond %{QUERY_STRING} ^(\d+)$ [NC]
RewriteRule ^cgi-bin/demo/dir1/$ /dir1/%1 [NC,L]
->In other words I am trying to hide (or change the real file location) sending the same querystring to the dir1 directory
thanks in advance for your kind help
Ben
I am trying to rewrite an expresion like this:
domainname/cgi-bin/demo/dir1/?var1=value1&var2=value2
into something like:
domainname/dir1/?var1=value1&var2=value2
I have this:
RewriteCond %{QUERY_STRING} ^(\d+)$ [NC]
RewriteRule ^cgi-bin/demo/dir1/$ /dir1/%1 [NC,L]
->In other words I am trying to hide (or change the real file location) sending the same querystring to the dir1 directory
thanks in advance for your kind help
Ben
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Simple Query String Question
Hello,
If all you need is a clean redirect:
but you'd probably need a second part:
Regards
If all you need is a clean redirect:
- Code: Select all
RewriteRule ^cgi-bin/demo/dir1/$ /dir1/ [NC,R=301,QSA,L]
but you'd probably need a second part:
- Code: Select all
RewriteCond %{QUERY_STRING} ^var1=\d+&var2=.*$ [NC]
RewriteCOnd %{REQUEST_FILENAME} !-f
RewriteCOnd %{REQUEST_FILENAME} !-d
RewriteRule ^dir1/$ /cgi-bin/demo/dir1/ [NC,QSA,L]
Regards
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests