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 have a few lines in my .htacess

Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^ [NC] 
RewriteRule ^(.*)$$1 [L,R=301]
# index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
# forum
RewriteCond %{REQUEST_URI} !^/forums/
RewriteRule index.php/(.*)$1 [R=301,L]

This code is works well, but i dont know if the code is standard.

I would like to set htaccess to:

* go to (its ok..)
* go to (its ok..)
* stay (its ok..? )
* go to (how?)

Could anyone help me to fix this code?

Thank you.

share|improve this question

migrated from Mar 18 '10 at 15:30

This question came from our site for professional and enthusiast programmers.

What exactly is your question, whether the rules are set all right or do you need to change the rules? – Pekka 웃 Mar 18 '10 at 14:52

If you are asking about the * go to (how?), you need to add this:

RewriteCond %{HTTP_HOST} ^ [NC] 
RewriteRule ^(.*)$$1 [L,R=301]
share|improve this answer

The simple answer is to configure a htaccess doc in your root public_html directory and subdomain directory. The root instructs the browser to use www and the subdomain doesn't.

Why do you want to show spammers where your blog is located? Its like hanging this sign on your home: front door is open.

share|improve this answer
.htaccess files are a hack. Simple, maybe, but not correct. – Deer Hunter Feb 18 '15 at 20:17
nonsense, htaccess are directives to apache before the site is hit. If you're referring to server configuration then I agree but from a client configuration, many directives are required because server admins are lazy. – Testbench Feb 18 '15 at 21:29

Your Answer


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