Jump to content

Help with RewriteRule ?


PHPFAN10

Recommended Posts

Hi,

 

I have a url like: http://www.example.com/user-verify.php?key=(40 alphanumeric characters here)

 

I want to Rewrite it so it displays like this:  http://www.example.com/verify/(40 alphanumeric characters here)

 

Could anyone help in making the Rewrite Rule please ?

 

I did look at the cheat sheet in sticky and cannot work it out.

 

Note sure if it makes any difference to the RewriteRule, but i want it so if someone types url in like:  http://www.example.com/verify/  (without a 40 char key) it will load the user-verify.php page still, as my php code displays an invalid activation key if one has not been specified.

 

Whilst i am at it, can i ask how i stop links in my posts being automatically linked ?  , i'm sure someone said to me use example.com so they don't get parsed as urls but seems to be parsing them for me.

 

Thank you,

phpfan

Link to comment
Share on other sites

Hi,

 

Managed to solve it,

 

I changed it to:

 

RewriteRule ^verify/([a-z0-9]+)?$ user-verify.php?key=$1 [NC,L]

 

and did not add the:

 

RewriteCond %{ENV:x} !yes

 

Thanks AyKay47, much appreciated, without your example i could not have sorted it, much appreciated.

 

Thanks

phpfan

Link to comment
Share on other sites

Hi,

 

Managed to solve it,

 

I changed it to:

 

RewriteRule ^verify/([a-z0-9]+)?$ user-verify.php?key=$1 [NC,L]

 

and did not add the:

 

RewriteCond %{ENV:x} !yes

 

Thanks AyKay47, much appreciated, without your example i could not have sorted it, much appreciated.

 

Thanks

phpfan

 

The environment variable is in place to make sure multiple rewrites do not happen.

Link to comment
Share on other sites

The environment variable is in place to make sure multiple rewrites do not happen.

Which isn't necessary because the new URL doesn't match the expression.

 

you're right in this case it's not needed. Just a habit.

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.