Anay Bose
Anay Bose

Reputation: 890

Redirect a url along with .htaccess and re-write rules gone wrong

I am trying to redirect http://localhost/anay-bose to http://localhost/anay-bose/1338.html (actual and valid url) via .htaccess

Here's my rule:

RewriteEngine On
RewriteRule ^([a-zA-Z0-9])$ /anaybose/$1 [R=301]
Redirect /anay-bose http://localhost/anay-bose/1338.html

Problem is it's redirecting to a url such as http://localhost/anay-bose/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html/1338.html

Lots of 1338.html while I just need one 1338.html

Looking for an insight.

Upvotes: 0

Views: 39

Answers (1)

Hebe
Hebe

Reputation: 810

You need to enhance it a little via RedirectMatch Directive

RedirectMatch ^/anay-bose$ http://localhost/anay-bose/1338.html

Upvotes: 1

Related Questions