Jump to content

Simple regexp help


play_

Recommended Posts

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?

Link to comment
Share on other sites

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.

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.