DotDragnet
May 21, 2012, 05:11:08 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Mobile users - Our forum is Tapatalk enabled. http://www.tapatalk.com/
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: htaccess query  (Read 1028 times)
sarahA
DDN Contribs
Hero Member
*****
Posts: 2174



View Profile WWW Awards
« on: November 01, 2007, 12:45:05 PM »

Can anyone tell me why the following may not work?

Code:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^sitemap.php?id=(.*)$ http://www.domain.co.uk/sitemap.php [L,R=301]

tyvm smile
Logged

JasonD
Global Moderator
Hero Member
*****
Posts: 546



View Profile Awards
« Reply #1 on: November 01, 2007, 01:02:51 PM »

\?

Otherwise it only matches sitemap.phpid= or sitemap.phid=

You need to (.*)$ to capture the end unless you use plan on using it in a back reference.
Logged
Jeewhizz
DDN Contribs
Hero Member
*****
Posts: 1626



View Profile Awards
« Reply #2 on: November 02, 2007, 11:38:48 AM »

You can't match a question mark on a rewriterule...

RewriteEngine On
RewriteCond %{QUERY_STRING} .
RewriteRule ^sitemap.php /sitemap.php? [L,R=301]

That should do something similar.
Logged

sarahA
DDN Contribs
Hero Member
*****
Posts: 2174



View Profile WWW Awards
« Reply #3 on: November 02, 2007, 12:06:06 PM »

Thanks for the comments. I'd tried your method too Jason, it still didn't work, but Jee's method does.

Just out of interest how easy would it be to just drop one specific variable from the URL eg index.php?a=1&b=2 to just index.php?b=2 ?

It's a potential future question wink
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!