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

I have recently had to change a URL on a website (in PHP on Apache).

The old URL is: http://content.mywebsite.org.uk/hidden/discounts/
When a user visits the above link.
The new URL is: http://www.mywebsite.org.uk/charity_benefits.php

I have tried variants of the following (and some others), but its just not working for me.

RewriteCond %{REQUEST_URI} ^/hidden/discounts/$ [NC]
RewriteRule ^/hidden/discounts/$ /charity_benefits.php [R=302,L,NC]

I need the redirect to redirect to www mywebsite.org.uk. (Notice the www! Its important!).

So basically, a simple redirect from the old page to the new page. (Which are on different subdomains (OLD: content., NEW: www.) which are hosted on the same server).

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

OK, Figured out the issue, posting it as the answer incase someone else has this simple issue.
Basically, I had 2 subdomains content. and www.
It turns out I was editing the wrong .htaccess file!

I needed to add the rewrite rule to the .htaccess which is hosted on content.
I was trying to add it to the .htaccess hosted on www..

So obviously it didnt work.

So if your redirects are not working (and your using multiple subdomains to point to different folders)...

MAKE SURE YOUR EDITING THE RIGHT .htaccess FILE!

(why do dumb things like this always happen to me!)

share|improve this answer
1  
You should accept this answer, too. –  msanford Oct 4 '12 at 15:19
    
It says I have to wait 2 days.. I will... in 2 days.. –  JustAnil Oct 4 '12 at 15:35
add comment

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.