wright67uk Posted August 15, 2011 Share Posted August 15, 2011 In my .htaccess file I change the url that appears in my browser to one that is more memorable. RewriteRule ^valeting\.html$ VALETING\.php?subtype=VALETING [L,NC] Which works well. OR RewriteRule ^valeting\.php$ VALETING\.php?subtype=VALETING [L,NC] Which also works well. Why is it that when I knock of the file extension such as; RewriteRule ^valeting$ VALETING\.php?subtype=VALETING [L,NC] All I get is a 404 error? How can I get around this? Quote Link to comment https://forums.phpfreaks.com/topic/244827-do-pretty-urls-require-a-file-extension/ Share on other sites More sharing options...
gizmola Posted August 15, 2011 Share Posted August 15, 2011 What is the complete .htaccess file? is there a subdirectory named /valeting in the directory? Quote Link to comment https://forums.phpfreaks.com/topic/244827-do-pretty-urls-require-a-file-extension/#findComment-1257792 Share on other sites More sharing options...
wright67uk Posted August 19, 2011 Author Share Posted August 19, 2011 Thank you for the reply, my htaccess file is now as below; I have a lot to learn but I realised that if I add \.* after valeting that I can miss off the extension in my browser. www.mysite.co.uk/VALETING.php?subtype=VALETING is the actual url that exists and www.mysite.co.uk/valeting is my now clean and fictional URL. <Files ~ "^\.(htaccess|htpasswd)$"> allow from all </Files> AddHandler x-httpd-php5 .php AddHandler x-httpd-php .php4 Options +Indexes +FollowSymlinks -MultiViews RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^(mysite\.co\.uk)(:80)? [NC] RewriteRule ^(.*) http://www.mysite.co.uk/$1 [R=301] RewriteRule ^courier\.*$ COURIER\.php?subtype=COURIER [NC,L,N] RewriteRule ^valeting\.*$ VALETING\.php?subtype=VALETING [NC,L,N] RewriteRule ^sales\.*$ SALES\.php?subtype=SALES [NC,L,N] order deny,allow I did have another question which is how can I get the above URLS and many others in the same format into one set of rules. eg. RewriteRule ^1$\.*$ 1$\.php?subtype=1$ [NC,L,N] Obviously this is very incorrect Im just a bit stuck, and im not really making a lot of sense of some of the tuts out there! Quote Link to comment https://forums.phpfreaks.com/topic/244827-do-pretty-urls-require-a-file-extension/#findComment-1259581 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.