Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to redirect 301 subdomain to same subdomain but in a new folder.

So I want to redirect http://sub.example.com/(.*) to http://sub.example.com/folder/

But when I go to folder the page does not open.

Notes:

  • I put the .htaccess in main subdomain.
  • I also get a redirect loop.
share|improve this question
up vote 1 down vote accepted

Based on your first comment, try this:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/folder/
RewriteRule ^(.*)$ folder/$1 [L,R=301]
share|improve this answer
    
yes works but if i go to links like this subdomain/one.html subdomain/two.html subdomain/three.html etc .. it not work to redirect to new folder ! i want to redirect it in new main page in folder .. like this subdomain/one.html -> subdomain/folder/one.html subdomain/two.html -> subdomain/folder/two.html subdomain/three.html -> subdomain/folder/three.html etc .. and thanks for all .. – ahmed Jul 7 '12 at 20:27
    
Please experiment with my update. – Jay Jul 7 '12 at 20:42
    
thanks .. thats work great – ahmed Jul 7 '12 at 21:45

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.