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
https://forums.phpfreaks.com/topic/261031-help-with-rewriterule/
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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.