Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

301 redirect problem

Status
Not open for further replies.

shpangle

Technical User
Feb 14, 2011
4
GB
Hi!

A link to my website has been posted on another forum however the actual link has been shortened:

http://[domain]/gallery/th...s.php?album=16

as you can see the word 'thumbnails' has been replaced by '...' the actual link should be:

http://[domain]/gallery/thumbnails.php?album=16

I have tried doing a 301 redirect in my .htaccess file but just can't get anything to work, not sure if its the syntax I am getting wrong or if its not possible in the first place? I have tried things like:

RewriteEngine ON
Redirect 301 /gallery/th...s.php?album=16 http://[domain]/gallery/thumbnails.php?album=16

Any ideas?

Thanks

Mick

 
A .htaccess redirect isn't going to work for that, you will have to catch it on the 404 error page THEN redirect from there.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
 
Many thanks for your reply Chris.

Just so I know for next time, what is the reason for not being able to trap this kind of thing by a .htaccess redirect?

Thanks

Mick

Jewellery designer and artist:
 
Hi!

I managed to get this working in the end (I am not one to give up even if I am told it won't work).

I implemented it in the .htaccess file as a redirect for dynamic URL’s (using the RewriteRule) and it works fine!.

Many thanks for all your help

Mick

Jewellery designer and artist:
 
Must be me then :D, the couple of times I've set urls truncated with ellipses .htaccess has bombed.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
 
Hi Chris,

I used this method and it works fine...

RewriteCond %{QUERY_STRING} ^album=16$
RewriteRule ^gallery/th\.\.\.s\.php$ [my domain]/gallery/thumbnails.php\?album=16 [R=301,L]

Only took me two days to get it working (I am so glad I am not a website developer!).

Mick

Jewellery designer and artist:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top