mb81 Posted March 27, 2008 Share Posted March 27, 2008 For purposes of SEO and content management, I use a simple rewrite code that takes a page name after a URL and send it as an id to the controller, like so: RewriteRule ^([a-z0-9]+)$ content.php?id=$1 [L] My challenge is this replaced a page structure that used files with similar names and a php extension, so I was trying to write a new rule that would take a URL like this: http://www.mysite.com/page1.php and change it to this: http://www.mysite.com/page1 So that it would match the pattern of the items above, so I wrote this line: RewriteRule ^([a-z0-9]+).php$ content.php?id=$1 [L] But, this tries to rewrite content.php, so I need to exclude the following names from that match: index,content,header,footer I tried a couple of different things, but couldn't get it to work, any help? Link to comment https://forums.phpfreaks.com/topic/98228-exclude-certain-word-from-pattern-match/ Share on other sites More sharing options...
Orio Posted March 29, 2008 Share Posted March 29, 2008 Try this: RewriteCond %{REQUEST_FILENAME} !content.php$ RewriteRule ^([a-z0-9]+).php$ content.php?id=$1 [L] Orio. Link to comment https://forums.phpfreaks.com/topic/98228-exclude-certain-word-from-pattern-match/#findComment-504190 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.