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
https://forums.phpfreaks.com/topic/240232-rewrite-not-working/
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
https://forums.phpfreaks.com/topic/240232-rewrite-not-working/#findComment-1234651
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.