Hi, I am working off local host and i want to use htaccess but i am unsure on the code that i would need. This is my normal re-write rule for a domain like e.g http://www.bob.com/info..php RewriteEngine On RewriteRule ^([a-zA-Z0-9-_]+)\.html$ info.php?title=$1 Code (markup): But on local host the url is: http://localhost/xampp/websites/site1/info.php so what would i put in the htaccess file for this? I was thinking something like this but it does not work; RewriteEngine On RewriteRule ^([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)\.html$ info.php?cat=$1&item=$2&other_item=$3&title=$4&others_items=$5 Code (markup): Cheers, Adam
Try this: RewriteEngine On RewriteBase /xampp/websites/site1/ RewriteRule ^([a-zA-Z0-9-_]+)\.html$ info.php?title=$1 Code (markup):
thank you for your reply, i have tried that but it does not seem to work? I just get the following error: Server error! The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. If you think this is a server error, please contact the webmaster. Error 500 localhost 10/01/08 10:12:34 Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b mod_autoindex_color PHP/5.1.4 Code (markup):
I have done it on my end with a joomla script that I got installed and available for testing, it seems to be working fine. (Note that I updated the code in my post once so maybe you caught the old one).
make sure the Apache version you are using support rewrite mode check Apache config file httpd.config find this line #LoadModule rewrite_module modules/mod_rewrite.so and remove the hash key to be this way LoadModule rewrite_module modules/mod_rewrite.so last step find this line # This should be changed to whatever you set DocumentRoot to. under this line search for #AllowOverride All remove the hash key to be this way AllowOverride All that is it you are done