Hi all, I installed Apache as part of WAMP package (it comes with Apache 2.0.59). In order to enable mod_rewrite in Apache I did the following: 1. Uncomment the following line in httpd.conf file: LoadModule rewrite_module modules/mod_rewrite.so 2. Put a .htaccess file in the root directory: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ super.html 3. Restart Apache If my understanding is correct, when I type www.somesite.com/super.html I should be redirected to www.somesite.com/index.php but this doesn't happen. Most probably my mod_rewrite engine is not enabled ? How can I test if it is truly enabled ? Regards, Razvan
I don't think that it is disabled, because I have this line in my httpd.conf file: Anyway, just to make sure: what other commands can I put there ? I mean just to test that .htaccess is working. (sorry, I am a beginner with this stuff) Regards, Razvan
I found the issue myself. In order for the .htaccess file to work you must give the directive "AllowOverride" for the respective folder: Since I am using virtual hosts my httpd.conf file now looks like this: <VirtualHost 127.0.0.1:80> ServerName [url]www.xml-forums.net[/url] ServerAlias xml-forums.net DocumentRoot D:/www-xml-forums.net LogLevel warn ServerSignature On <Directory "D:/www-xml-forums.net"> Options Indexes FollowSymLinks [COLOR="Red"][B]AllowOverride All[/B][/COLOR] Order allow,deny Allow from all </Directory> </VirtualHost> Code (markup):
Use RewriteEngine On RewriteBase / RewriteRule ^super\.php$ index.html [L] IF index.html is the original URL, with super.php being the fake URL. Then super.php should show the same thing as index.html. It doesn't redirect to the original URL.
I understand that. The problem was the command "AllowOverride All" that has to be applied for the folder where you want to use .htaccess. Is this a security risk ? Is there a more restrictive settings that you people use instead of "All" ?