Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 have my main domain URL mapped to the root of my server

I have a wordpress installation installed under /blogs/techblog

I want to direct any traffic coming in at to >

If I point the URL itself to the subdirectory then my installation will not work

Is it possible to do this with an .htaccess file in the root of my server?

I have tried the following, but it creates an "endless loop"

Redirect 301 /
share|improve this question

I think the problem is, that Redirect also redirects sub-paths, like /foo or in this case /blogs/techblog and appends it to the new location. This may be helpful, because if you move a whole website to another location (as the HTTP status already says Moved Permanently), old links still work.

In your case, this behaviour is not very helpful, but you can try using mod_rewrite instead:

RewriteEngine on
RewriteRule  ^/$    /blogs/techblog  [L]

The regex ^/$ ensures, only locations which are exactly / will be redirected and the [L] tells apache to stop doing any rewrites after this lines.

share|improve this answer

Did you initially install the blog at I'm guessing you did, because Wordpress will redirect to the server name it has. The way to fix it is to move it back, login to your wp-admin, change the server name to, and move it back. There's probably a cleaner way to do it inside the database/configuration files.

share|improve this answer

Your Answer


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.