...

View Full Version : [SOLVED] htaccess rewrite old to new URL - Old URL is index.php?page=



CBG
04-22-2011, 02:23 PM
Hi,

I would like to rewite the following using .htaccess

From: index.php?page=allnews
To: news.php

But sometimes the from is like: index.php?page=allnews&results_per_page=20
I am not wanting the &results_per_page=20 bit put on to the new URL.

I have tried:
RewriteRule ^/index.php?{%QUERY_STRING}&page=allnews$ news.php [R=301,L]

Also tried using cPanel redirect system, but it wasn't including the ?page= bit so it was redirecting the index.php which I don't want.

Can anyone help please?
Thanks

CBG
04-22-2011, 02:29 PM
I have just tried



RewriteCond %{QUERY_STRING} page=allnews
RewriteRule ^index.php$ news.php [R=301,L]


The problem with this the URL it is: news.php?page=allnews
I am wanting to strip everything after news.php in the rule

CBG
04-22-2011, 02:47 PM
Hi,

Have got it now, it was all in a ? (question mark)


RewriteCond %{QUERY_STRING} page=allnews
RewriteRule ^index.php$ news.php? [R=301,L]



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum