justlukeyou Posted July 14, 2013 Share Posted July 14, 2013 Hi, I have fixed one problem only to make another one. I have added a piece of code to my htaccess file which allows me to add the product title to the link for SEO purposes= .com/123456/large-red-widget However it now affects all the other links which have a query in. Can anyone advise how I can just isolate products/product to have a second variable after the one which operates the query? RewriteRule ^products/product/([0-9]+)/(.*)$ products/product.php?product_id=$1 [QSA,L] RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-z]+)/([a-z\-]+)$ /$1/$2.php [QSA,L] RewriteRule ^products/product/([0-9]+)/(.*)$ products/product.php?product_id=$1 [QSA,L] RewriteRule ^articles/article/([0-9]+)/(.*)$ articles/article.php?ID=$1 [QSA,L] RewriteRule ^articles/articlesfiltered/([A-Za-z]+)/(.*)$ articles/articlesfiltered.php?articlecategory=$1 [QSA,L] RewriteRule ^plusstyle/plusstyle/([0-9]+)/(.*)$ plusstyle/plusstyle.php?ID=$1 [QSA,L] RewriteRule ^plusstyle/plusstylesfiltered/([A-Za-z]+)/(.*)$ plusstyle/plusstylesfiltered.php?articlecategory=$1 [QSA,L] Quote Link to comment https://forums.phpfreaks.com/topic/280153-isolate-one-link-hor-htaccess-affect/ Share on other sites More sharing options...
AbraCadaver Posted July 14, 2013 Share Posted July 14, 2013 This will match first before any of the other rule so you can try moving it to the end of the list: RewriteRule ^([a-z]+)/([a-z\-]+)$ /$1/$2.php [QSA,L] Quote Link to comment https://forums.phpfreaks.com/topic/280153-isolate-one-link-hor-htaccess-affect/#findComment-1440725 Share on other sites More sharing options...
justlukeyou Posted July 15, 2013 Author Share Posted July 15, 2013 Thanks, I have tried that but it has had no impact. Is it possible only affect how the products link works as this is the only page I want to have a slug in the title. The other links within site are fine with just one variable in. RewriteRule ^products/product/([0-9]+)/(.*)$ products/product.php?product_id=$1 [QSA,L] Quote Link to comment https://forums.phpfreaks.com/topic/280153-isolate-one-link-hor-htaccess-affect/#findComment-1440842 Share on other sites More sharing options...
justlukeyou Posted July 18, 2013 Author Share Posted July 18, 2013 Hi, Does anyone have any suggestions. I post the job on oDesk and someone quoted me 10 hours. 10 freaking hours to write a few lines of code. Can you believe it? Quote Link to comment https://forums.phpfreaks.com/topic/280153-isolate-one-link-hor-htaccess-affect/#findComment-1441306 Share on other sites More sharing options...
requinix Posted July 18, 2013 Share Posted July 18, 2013 What were the rewriting rules before you made the change? And exactly how does it "affect all the other links"? Quote Link to comment https://forums.phpfreaks.com/topic/280153-isolate-one-link-hor-htaccess-affect/#findComment-1441307 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.