Jump to content

do pretty urls require a file extension?


wright67uk

Recommended Posts

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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.