PHPFAN10 Posted April 16, 2012 Share Posted April 16, 2012 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 Quote Link to comment Share on other sites More sharing options...
requinix Posted April 16, 2012 Share Posted April 16, 2012 What have you tried so far? You're probably very close already. And I don't know about the links, and I haven't seen any settings for it. You can add a space or something to break them. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted April 16, 2012 Share Posted April 16, 2012 Perhaps something like this. RewriteEngine On RewriteCond %{ENV:x} !yes RewriteRule ^verify/([a-z0-9]+)?$ user-verify.php?key=$1 [NC, E=x:yes] Quote Link to comment Share on other sites More sharing options...
PHPFAN10 Posted April 16, 2012 Author Share Posted April 16, 2012 DELETE PLEASE (SORRY) Quote Link to comment Share on other sites More sharing options...
PHPFAN10 Posted April 16, 2012 Author Share Posted April 16, 2012 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 Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted April 16, 2012 Share Posted April 16, 2012 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. Quote Link to comment Share on other sites More sharing options...
requinix Posted April 16, 2012 Share Posted April 16, 2012 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. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted April 16, 2012 Share Posted April 16, 2012 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. 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.