Change directory and variables
2 posts
• Page 1 of 1
Change directory and variables
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
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
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Change directory and variables
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:
Regards
Andrew
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
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 4 guests