c_pattle Posted June 2, 2011 Share Posted June 2, 2011 I'm trying to use mod_rewrite to rewrite my urls. At the moment the url I want to rewrite is http://localhost/web/index.php?colour=red and I want to change it to http://localhost/web/colour/red I've uploaded a .htaccess file to the "web" directory but I keep getting a 404 error page. I've included the contents of my .htaccess file below. RewriteEngine on RewriteRule ^/colour/([A-Za-z0-9]+)$ /?colour=$1 Thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/238233-mod_rewrite-help/ Share on other sites More sharing options...
wildteen88 Posted June 2, 2011 Share Posted June 2, 2011 If the .htaccess file is in web/ Your rewrite rule should be RewriteRule colour/([A-Za-z0-9]+)$ index.php?colour=$1 Quote Link to comment https://forums.phpfreaks.com/topic/238233-mod_rewrite-help/#findComment-1224283 Share on other sites More sharing options...
c_pattle Posted June 2, 2011 Author Share Posted June 2, 2011 Thanks for your help Once I have started using mod_rewrite will I then need to change all of my URL to things like style sheets and links to other pages because at the moment my pages have no styles? Quote Link to comment https://forums.phpfreaks.com/topic/238233-mod_rewrite-help/#findComment-1224392 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.