n000bie Posted May 20, 2010 Share Posted May 20, 2010 Well, I am total new to mod_rewrite and can't grasp the basic. I am trying to convert my url from http://localhost/mysite/activity.php?c_id=1&a_id=28 to http://localhost/mysite/activity/components/articles this is my htaccess code Options +FollowSymLinks RewriteEngine On RewriteRule ([a-zA-z])+/([a-zA-z])\.html$ activity.php?c_id=$1&a_id=$2 It is not working, can anyone tell me what I am doing wrong. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/202360-simple-mod_rewrite-help/ Share on other sites More sharing options...
cags Posted May 20, 2010 Share Posted May 20, 2010 a.) What seriously makes you think your current rule is remotely close. Even without any understanding of mod_rewrite it should be fairly obvious that a RewriteRule that contains .html is probably not right when neither of the URIs you have listed include .html. b.) A rewrite is impossible given those two URLs, there is no possible way to convert one of those to the other using mod_rewrite. Quote Link to comment https://forums.phpfreaks.com/topic/202360-simple-mod_rewrite-help/#findComment-1061029 Share on other sites More sharing options...
n000bie Posted May 20, 2010 Author Share Posted May 20, 2010 Thanks, I am new to this mod_rewrite (it is like a nightmare). I will check some tutorials first. anyway thanks for replying Quote Link to comment https://forums.phpfreaks.com/topic/202360-simple-mod_rewrite-help/#findComment-1061068 Share on other sites More sharing options...
cags Posted May 20, 2010 Share Posted May 20, 2010 Just to clarify what I meant by it's not possible. A RewriteRule does exactly what the name suggests it 'Rewrites' the URL. This allows you to use either fixed values or values found in the URL that you are rewriting. Since your pretty URL doesn't include the numbers 1 or 28 you can't possibly redirect to that URL (unless you always want the value 1 & 28, but that would seem pretty pointless). Quote Link to comment https://forums.phpfreaks.com/topic/202360-simple-mod_rewrite-help/#findComment-1061070 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.