PDA

View Full Version : .htaccess



Techie
02-04-2010, 08:25 PM
I know this is the wrong place to post but I couldn't find a better category. I'd like to ask if WestHost has disabled .htaccess files by default? Things like the rewrite and redirecting don't work (I get the .htaccess scripts from other sites but they don't work). Does WestHost disable them or do I need to do anything special? Thanks.

wildjokerdesign
02-05-2010, 07:29 AM
Are you on a WH 3.0 account? If so is this on an addon domain that is not located in /var/www/html. If you answer yes to both then the answer is yes. .htaccess is only available in /var/www/html unless you modify /etc/httpd/conf/httpd.conf.

You need to edit the VirtualHost tag for the domain in question. Here is an example of it after editing.

<VirtualHost *:80>
ServerName addondomain.com
ServerAlias www.addondomain.com
DocumentRoot /path/to/addondomain
<Directory "/path/to/addondomain">
Options FollowSymLinks MultiViews Includes ExecCGI
AddHandler cgi-script .cgi .pl .py .sh
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

/path/to/addondomain depends on where you decided the public root of the domain should be.

You then need to restart your account either via SSH command line using the command restart or you can do it in Site Manager with the link in the left column.

Be careful when editing the httpd.conf file. It must be edited on the server via SSH with something like pico or vi or you must make sure you edit it on your local computer with a plain text editor and then transfer it in ASCII mode. Make a backup of the original before you edit. A mistake in your httpd.conf file even one character and keep Apache from starting.

Techie
02-06-2010, 08:49 AM
The answer is yes to both of those.

If I edit this will .htacces still work at /var/www/html ?

Things like Wordpress and PHPbb use .htaccess in internal folders so would I have to combine all of them into one .htaccess at the root directory?

Is there something like a WestHost 4.0 account that I could upgrade to so this doesn't happen?
Thanks.

wildjokerdesign
02-06-2010, 04:49 PM
Sorry it took me so long to answer you. I was locked out of the forum for most of the day. :)

Yes .htaccess will still work in the /var/www/html directory.

No you would not want to combine your .htaccess files for wordpress and phpBB. They should stay separate and reside in the directory they are installed into. Most .htaccess files for programs like this are designed to rout any link that does not match an actual file or directory on the system through the index.php file for that program. The index.php then takes the URL and determines what page to serve up. If you combined them and placed them in the root then they would not have the separate index.php files to route through. :)