Jump to content

Rewrite not working


c_pattle

Recommended Posts

I have the following in my .htaccess file. 

 

RewriteEngine on

Options -Indexes

 

#Re-write rules

RewriteRule ^/([A-Za-z0-9]+)$ $1.php

RewriteRule colour/([A-Za-z0-9]+)$ index.php?colour=$1

RewriteRule article/([0-9]+)$ article.php?number=$1

 

My first two rewrite rules work but the last one doesn't.  I want the url - article.php?number=1 - to be replaced with - article/1.  At the moment the redirect still takes me to the article.php page but the "number" variable seems to not be defined. 

 

Thanks for any help. 

Link to comment
Share on other sites

multiviews allows you to call for files without stating their extension. When it is enabled you can call site.com/about.php using site.com/about

 

Explanation from the manual

A MultiViews search is enabled by the MultiViews Options. If the server receives a request for /some/dir/foo and /some/dir/foo does not exist' date=' then the server reads the directory looking for all files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements, and returns that document.[/quote']
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.