I know that this question have been asked several times. But I can't get it to work.
I installed Apache2 in my Ubuntu server I can also confirm that mod_rewrite is installed using phpinfo();. I have also put a file called .htaccess in my root folder(/var/www/.htaccess). In my .htaccess file I paste the following code:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^.*$ test.php
So everything is redirected to test.php
But it still doesn't work. So I checked my httpd.conf file under /etc/apache2. It is completely empty, with no lines of code (This seems a little odd to me)?! However checking in Stackoverflow answers there should be at least the following code in httpd.conf:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory>
So I paste that code in httpd.conf. And restarted Apache with sudo /etc/init.d/apache restart
. And it still does not work?
I have also tested to open the file /sites-enabled/000-default and /sites-available/default, where all virtual host settings lies and change under the directory /var/www
and /
to AllowOverride All. The mod_rewrite still doesn't work. Can anyone please help me. This problem has been baking my nuts for a while.
Also, my apache2.conf file doesn't work. I tried to write som nonsense. And it is still gives me the normal result instead of http 500 error
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…