Change directory and variables

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 5
Joined: 03 Oct 2012, 22:09

Change directory and variables

13 Jun 2013, 17:11

Dear all,

my old path has a directory and a filename with a lots of variables.
Now I want to redirect it to a simple filename.

Example:
directory/filename.php?id=1&another=2&more=3

Should be:
filename.html

The directory and all variables not longer necessary.

I tried, but it doesn´t work:
RewriteRule ^directory/filename.php(.*) filename.html [R=301]

Many thx for help and best regards from Germany
Hagen

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Change directory and variables

13 Jun 2013, 22:28

Hello,

Doesn't seem like there's something wrong. My guess would be that you need '/' in front of the pattern AND add a condition:

Code: Select all
RewriteCond %{QUERY_STRING} ^.+$ [NC]
RewriteRule ^/directory/filename\.php /filename.html [NC,R=301,L]


Regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 4 guests