Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

301 Redirect Confusion With Variables


  • Please log in to reply
2 replies to this topic

#1 piskie

piskie

    HR 7

  • Active Members
  • PipPipPipPipPipPipPip
  • 1,098 posts
  • Location:Cornwall

Posted 21 April 2011 - 12:10 PM

Could anyone please help me with a redirect that I am trying to mend.
Apparently, it was auto generated within Cpanel.

I would like all files within a directory and it's subdirectory to be 301'd to a different directory and discard all file names and Variables on the way.
Somehow, the redirect in use is carrying the variables and attaching them to the new directory.
QUOTE
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.co.uk$
RewriteRule ^shop\/\/?(.*) "http\:\/\/www\.domain\.co\.uk\/stores\/index\.php" [R=301,L]

So the objective is to redirect all requests for anything in the directory and it's sub-directories:
domain.co.uk/shop/ to domain.co.uk/stores/
What is happening at the moment is that redirected requests are carrying over the variables as:
domain.co.uk/stores/?pid=63

Any help would be extremely useful as htaccess is not my strong point.

#2 Tiggerito

Tiggerito

    HR 2

  • Members
  • PipPip
  • 49 posts
  • Location:Adelaide, South Australia

Posted 21 April 2011 - 10:31 PM

Add a ? to the destination URL:

RewriteRule ^shop\/\/?(.*) "http\:\/\/www\.domain\.co\.uk\/stores\/index\.php?" [R=301,L]



#3 piskie

piskie

    HR 7

  • Active Members
  • PipPipPipPipPipPipPip
  • 1,098 posts
  • Location:Cornwall

Posted 22 April 2011 - 02:20 AM

Thanks so much Tiggerito, that was so simple and worked a treat.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

SPAM FREE FORUM!
 
If you are just registering to spam,
don't bother. You will be wasting your
time as your spam will never see the
light of day!