natasha_thomas Posted May 9, 2010 Share Posted May 9, 2010 Friends, How you all? My Existing URL Structure is: http://mydomain.com/index.php?kw=anykeyword&p1=anyparameter1&p2=anyparameter2 I want this Structure to be like: http://mydomain.com/index.php/anykeyword/anyparameter1/anyparameter2 BTW, Is the below Structure also Possible (It Will be Awsome to have the Below One.. If POssible) http://mydomain.com/anykeyword/anyparameter1/anyparameter2.htm What shall i Put in my .Htaccess file to achieve the same? Please may someone help? Sure a Coffee/beer is deal, if you get to visit DC. Thanks all you Geeks Natty T Quote Link to comment https://forums.phpfreaks.com/topic/201164-what-to-enter-in-htaccess-file-to-get-this-desired-url-structure/ Share on other sites More sharing options...
cags Posted May 9, 2010 Share Posted May 9, 2010 The rewrite rule would be something like this.. RewriteRule ^([^/]+)/([^/]+)/([^/]+)\.html$ /index.php?kw=$1&p1=$2&p2=$3 Quote Link to comment https://forums.phpfreaks.com/topic/201164-what-to-enter-in-htaccess-file-to-get-this-desired-url-structure/#findComment-1055494 Share on other sites More sharing options...
natasha_thomas Posted May 9, 2010 Author Share Posted May 9, 2010 The rewrite rule would be something like this.. RewriteRule ^([^/]+)/([^/]+)/([^/]+)\.html$ /index.php?kw=$1&p1=$2&p2=$3 hello, I just tried this code, seems no luck, i still see the same URL structure.... http://mydomain.com/index.php?kw=Kitchen-Aid-Stand-Mixer-Hd-Series&p1=Kitchen-Aid-KG25H3XER-Empire-Red-Professioanl-HD-Series-Stand-Mixer&p2=B001OFV6QC :'( Any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/201164-what-to-enter-in-htaccess-file-to-get-this-desired-url-structure/#findComment-1055501 Share on other sites More sharing options...
cags Posted May 9, 2010 Share Posted May 9, 2010 You would, the purpose of the code is not to change the structure, but to make the new structure map to the old one. With that code, requesting... http://mydomain.com/Kitchen-Aid-Stand-Mixer-Hd-Series/Kitchen-Aid-KG25H3XER-Empire-Red-Professioanl-HD-Series-Stand-Mixer/B001OFV6QC ...will display the contents of... http://mydomain.com/index.php?kw=Kitchen-Aid-Stand-Mixer-Hd-Series&p1=Kitchen-Aid-KG25H3XER-Empire-Red-Professioanl-HD-Series-Stand-Mixer&p2=B001OFV6QC Quote Link to comment https://forums.phpfreaks.com/topic/201164-what-to-enter-in-htaccess-file-to-get-this-desired-url-structure/#findComment-1055505 Share on other sites More sharing options...
natasha_thomas Posted May 10, 2010 Author Share Posted May 10, 2010 What you just said made lot of sense... I Appreciate... Though, i am still not able to achieve this... coz i think i am doing something wrong in the below part: $this->aws["template"] = str_replace("%%niceseolink%%",'index.php?".$kwtoken."."/".".$myprodtitle."."/".$myprodasin.".htm', $this->aws["template"]); I am passing the whole URL structure through %%niceseolink%% in a HTML Template... Am sure there is smething wrong in this to confirm with : RewriteRule ^([^/]+)/([^/]+)/([^/]+)\.html$ /index.php?kw=$1&p1=$2&p2=$3 May you help me Spot the Odd in my Code? Quote Link to comment https://forums.phpfreaks.com/topic/201164-what-to-enter-in-htaccess-file-to-get-this-desired-url-structure/#findComment-1055635 Share on other sites More sharing options...
cags Posted May 10, 2010 Share Posted May 10, 2010 You are placing index.php? into the link, the pattern doesn't match that as explained in my last post. Quote Link to comment https://forums.phpfreaks.com/topic/201164-what-to-enter-in-htaccess-file-to-get-this-desired-url-structure/#findComment-1055717 Share on other sites More sharing options...
natasha_thomas Posted May 10, 2010 Author Share Posted May 10, 2010 $this->aws["template"] = str_replace("%%niceseolink%%",'index.php?".$kwtoken."."/".".$myprodtitle."."/".$myprodasin.".htm', $this->aws["template"]); So, yes i am placing index.php in the link... Is my Link formation Correct? 'index.php?".$kwtoken."."/".".$myprodtitle."."/".$myprodasin.".htm' Quote Link to comment https://forums.phpfreaks.com/topic/201164-what-to-enter-in-htaccess-file-to-get-this-desired-url-structure/#findComment-1055723 Share on other sites More sharing options...
cags Posted May 10, 2010 Share Posted May 10, 2010 As I have said now in my two previous posts, NO. The pattern provided doesn't expect index.php? to be in the URL, it should be of the form... domain.com/$kwtoken/$myprodtitle/$myprodasin.html Quote Link to comment https://forums.phpfreaks.com/topic/201164-what-to-enter-in-htaccess-file-to-get-this-desired-url-structure/#findComment-1055733 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.