Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have some requests like

blogs.bobvilapaint.com/11/11/2011/title

which I would like to redirect to

staging.bobvila.com/blogs/title

I've written

RewriteRule ^[0-9/]+/[0-9]+/[0-9]+/(.*)$ http://staging.bobvila.com/blogs/$1 [R,L]

But instead of being redirected to

staging.bobvila.com/blogs/title

Its being redirected to

staging.bobvila.com/title

So I don't understand why the redirect rule its eating the "blogs" directory on the redirection to the new server.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The regular expression may not be correct,

Try with this :

RewriteRule ^[0-9/]+/[0-9]+/[0-9]+/(.*) http://staging.bobvila.com/blogs/$1 [L]

Let me know if it works.

share|improve this answer
    
I tried with that rule, and then I go to blogs.bobvilapaint.com/07/11/2011/how-to-install-door-hardware but the rule is still eating the "blogs" word :( –  rorra Feb 20 '12 at 18:15
    
can you paste here the address you are typing on browser, and the address that it should be redirected to ? –  GersonO Feb 20 '12 at 18:24
1  
Please, also ensure that you do not have another .htaccess that could be overriding the current configuration. Maybe you are redirectioning something on the blogs folder, and thats why it gets deleted. –  GersonO Feb 20 '12 at 18:27
    
    
You are totally right, the problem was with another redirection rules on the .htaccess Thank you a lot, I spent hours trying to figure out what the problem was :) –  rorra Feb 20 '12 at 18:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.