I have configured a virtual host in my local machine and every thing is working fine.
Now I want to use SEO friendly urls. To achieve this I have used the .htaccess file.
My virtual host configuration is:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/ypp"
ServerName ypp.com
ServerAlias www.ypp.com
##ErrorLog "logs/dummy-host2.localhost-error.log"
##CustomLog "logs/dummy-host2.localhost-access.log" combined
</VirtualHost>
and my .htaccess file has:
AllowOverride All
RewriteEngine On
RewriteBase /ypp/
RewriteRule ^/browse$ /browse.php
RewriteRule ^/browse/([a-z]+)$ /browse.php?cat=$1
RewriteRule ^/browse/([a-z]+)/([a-z]+)$ /browse.php?cat=$1&subcat=$2
The above .htaccess setting is not working.
After that I modified my virtual host setting and it is working.
The new virtual host setting is:
<VirtualHost *:80>
RewriteEngine On
RewriteRule ^/browse$ /browse.php
RewriteRule ^/browse/([a-z]+)$ /browse.php?cat=$1
RewriteRule ^/browse/([a-z]+)/([a-z]+)$ /browse.php?cat=$1&subcat=$2
ServerAdmin
[email protected]
DocumentRoot "C:/xampp/htdocs/ypp"
ServerName ypp.com
ServerAlias www.ypp.com
##ErrorLog "logs/dummy-host2.localhost-error.log"
##CustomLog "logs/dummy-host2.localhost-access.log" combined
<Directory "C:/xampp/htdocs/ypp">
AllowOverride All
</Directory>
</VirtualHost>
Please let me know where I am going wrong in the .htacess file for url rewriting. I do not want to use the settings in virtual host, since for every change I have restart apache.