play_ Posted April 7, 2009 Share Posted April 7, 2009 For my mod_rewrite rules, i use this RewriteRule ^([A-Za-z0-9-]+)$ $1.php [L] so i go to www.site.com/contact and it's like going to www.site.com/contact.php But some php files have more than 1 '.' in them, for example add.entry.php. How could i make this work? Quote Link to comment Share on other sites More sharing options...
nrg_alpha Posted April 7, 2009 Share Posted April 7, 2009 While I'm not well versed in mod_rewrites, wouldn't this work better? RewriteRule ^([./a-z0-9-]+)$ $1.php [L,NC] Again, I'm not familair with mod stuff, so I might be missing something here.. Quote Link to comment Share on other sites More sharing options...
play_ Posted April 7, 2009 Author Share Posted April 7, 2009 That caused an internal server error =S I'll be honest with you... i've been using php for 4years, and ive always dodged regex. Quote Link to comment Share on other sites More sharing options...
nrg_alpha Posted April 7, 2009 Share Posted April 7, 2009 I edited my post to replace the .\php with .php Not sure if that makes a difference or not...(Am I right in assuming you need to find urls that include a file.. in other words, something slash(/) something? As I could see an issue if the url is say www.example.com. What you want is to add .php at the end, but in that case, the url wouldn't make sense - www.example.com.php) Perhaps: RewriteRule ^([^/]+/?)+$ $1.php [L] While I am familar with regex, I'm not with this kind of stuff. And it's late for me.. so working on stuff while tired certainly doesn't lend well either I'm afraid. You can give that last sample a shot, but I'm convinced it can be better.. Time for me to turn it in for the night.. Hopefully youi find the solution if none of these work out. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.