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.

Running on Ubuntu Server 10.10 on a VPS. Running Apache2 with mod_rewrite enabled. phpinfo() shows mod_rewrite.

core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_proxy mod_proxy_http mod_reqtimeout mod_rewrite mod_setenvif mod_status

Apache was freshly installed, no real changes.. just got this VPS to start experimenting on. I enabled mod_rewrite using this command:

sudo a2enmod rewrite

I created my .htaccess file and added it to my www directory containing this code:

RewriteEngine on
RewriteRule ^alice.html$ bob.html

both html files are in the same www directory as the .htaccess file, I made sure to restart the server after changes, and I have ensured there are no simply spelling or capitalization mistakes. Any suggestions would be appreciated, Thanks.

share|improve this question
add comment

1 Answer

You probably haven't allowed .htaccess files to perform mod_rewrite options. You need to set that with AllowOverride.

share|improve this answer
3  
And unless you need to use htaccess files specifically for some reason (pretty much only shared hosting environments, which this isn't), then don't do it. See here. In general, you should only use .htaccess files when you don't have access to the main server configuration file. There is, for example, a common misconception that user authentication should always be done in .htaccess files, and, in more recent years, another misconception that mod_rewrite directives must go in .htaccess files. This is simply not the case. –  Shane Madden May 5 '12 at 0:29
    
@ShaneMadden A very good point I should have included in my answer. –  wfaulk May 5 '12 at 0:40
add comment

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.