The Little Guy Posted October 27, 2009 Share Posted October 27, 2009 I was using this mod rewrite: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+?)$ /page.php?name=$1 [L,QSA] I needed to change line 4, I want a url to look like this: http://site.com/TheLittleGuy So that worked, but now I need to change it a little bit. I need it so only the part after the slash applies to words that starts with an uppercase letter or a number. other that that I don't want that rewrite to apply to the name after the slash. Any suggestions on a fix for this? I have tried this, but it doesn't work: RewriteRule ^(([A-Z]|[0-9]).+?)$ /page.php?name=$1 [L,QSA] It works if the name is uppercase, but if not, it can't find the file http://site.com/TheLittleGuy <- Works http://site.com/help <- Doesn't work, and this file does exist Link to comment https://forums.phpfreaks.com/topic/179275-rewriterule-on-uppercase-words/ Share on other sites More sharing options...
The Little Guy Posted October 27, 2009 Author Share Posted October 27, 2009 OK... It does work, but only if I put help.php how do I remove the php extension? Using this removes the extension (last line), but it doesn't work along with the second to last line, if I comment out the second to last line, then I can do http://site.com/help otherwise having them both active breaks the site... RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(([A-Z]|[0-9]).+?)$ /page.php?name=$1 [L,QSA] RewriteRule ^(.*)$ $1.php [L,QSA] Link to comment https://forums.phpfreaks.com/topic/179275-rewriterule-on-uppercase-words/#findComment-945871 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.