I need your help! (sorry for my bad english)
I try to do url rewriting in my localhost on Ubuntu13.10/Apache2.4.6 ... I searched a lot of time on internet and problem is always here..
this is my .htaccess (I begin in url rewriting so I don't know if it's ok) :
RewriteEngine On
AllowFromAll All
RewriteRule home/ index.php?uc=home
and when I go to 127.0.0.1/mywebsite/home/
I have a 404 error.
Please, I don't know what to do...
After many tests : I think I have a problem of AllowOverride
You either need to specify the RewriteBase
RewriteBase /mywebsite/
RewriteRule home index.php?uc=home [L]
or add it to your rule
RewriteRule /mywebsite/home index.php?uc=home [L]
I think this is more like this :
RewriteRule is relative to the RewriteBase, so if your .htacess is in /mywebsite/ folder :
RewriteBase /
RewriteRule /home index.php?uc=home [L]
this way it should work, let me know ;)
So... If this is not working, let's start by the beginning.
LoadModule rewrite_module libexec/mod_rewrite.so
and AddModule mod_rewrite.c
should be in there, and without comment mark (#)
# The server must follow symbolic links (this can help in some apache versions)
Options +FollowSymlinks
# RewriteEngine activation
RewriteEngine on
# RewriteRule
RewriteRule ^home$ index.php?uc=home [L]
This configuration works on my apache 2.2.22.
The truth is that
/index.php?uc=home [L]
points on http://127.0.0.1/index.php
instead of http://127.0.0.1/mywebsite/index.php
because of the DocumentRoot
property. On a real domain, or /w a virtualhost pointing on /mywebsite/, /index.php?uc=home [L]
should work.
Keep in mind that RewriteRule is relative to the DocumentRoot
and RewriteBase
can't resolves this problem.