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'm migrating one of my websites from dreamhost shared to dreamhost ps. the files copied OK and DNS resolved to the new server. However trying to get a pagw brings error 403 access forbidden.

If I remove the .htaccess file from the directory of the site. the homepage loads OK but naturally any other page does not (because it requires rewriting currently defined in .htaccess).

I believe that httpd.conf blocks usage of .htaccess in the new server. quote:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

I tried removing htaccess and implementing the rewrite rules in httpd.conf. without success.

My questions: 1. I tried AllowOverride All to make .htacces work. It didn't change anything. What else should be checked/done to make it work?

  1. I created a directory section in httpd.conf with the directory in which the httpdocs sit and put all the rewrite rules there. (and restarted the server). it didn't have effect. Any hints on what should be done to add directory part with rewriterules to .httpd.conf and troubleshooting tips?

  2. How can I check if mod-rewrite is working on this server? It is enabled on the httpd.conf file. The server is on fastcgi mode.

Any other tips are very appreciated.

Thanks, Niro

How can I move the rewrite rules in .htaccess in httpd.conf (and make it work)

share|improve this question

3 Answers 3

The Directory / directive defines the base rules for all directories on the system. Usually after defining a Directory / directive, you have a Directory /my/web/root/here directive with more liberal configuration settings.

Do not confuse Directory / to mean the webroot of your web site, this is not the case.

Your re-write rules should be applied either inside of the Directory /my/web/root/here directive, or the VirtualHost for the particular site (if you are using VirtualHosts, very common).

Changing AllowOverride to All in Directory / may be overwritten by a defined Directory /my/web/root/here, or a VirtualHost for the site in particular.

Perhaps if you could pastebin (http://www.paste2.org/) the entire Apache configuration, we could get a better idea of the issue.

share|improve this answer

The Apache user should have read access to the .htaccess file.

share|improve this answer
up vote 0 down vote accepted

Thanks for the answers. I finally discovered that the actual httpd.conf file was under another path, It was not visible due to permissions. Just in case someone need it it was at:

/usr/local/dh/apache2/apache2-psnum/etc/ (psnum is the server number)

I placed the rewrites there under the directory section of my site and everything works.

share|improve this answer

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.