aurelou Posted January 28, 2017 Share Posted January 28, 2017 Hello, In my previous site I had a category in which I put sold products (for my activity it's interesting for the customers to see them). Now I changed this and I want all my product pages from this category to redirect to a unique page (in which I put the pictures of sold products). Is it possible to write it in a line in .htaccess or do I have to do it manually for each product page ? Thanks a lot for your help. Link to comment Share on other sites More sharing options...
MrPhil Posted January 28, 2017 Share Posted January 28, 2017 If you can determine something common for the URIs of all these pages in question (such as a category name or number), you should be able to have a single redirection in .htaccess. It will depend on if you're using some sort of SEO, etc. If these pages' URIs share something in common with other pages (you don't want redirected), you would have to add check(s) in .htaccess to exclude those other pages. It should be possible. Also decide if you want this to be permanent, or just temporary, and whether you want visitors to see the new address. Link to comment Share on other sites More sharing options...
aurelou Posted January 28, 2017 Author Share Posted January 28, 2017 Thanks a lot @@MrPhil. I'm not familiar with the redirections. My URLs had nothing in common, just the product name and ID... So after seeing your post I searched for a solution. I couldn't make all my redirections in a line but I managed to make them quicky. I have a little software (Xenu) which dresses me the list of all my URLs and their titles. Fortunately the product pages titles began with the category name so I could sort all my URLs by title and have a list of my product URLs from that category. Then with excel it was very easy to make quickly all the redirections. Link to comment Share on other sites More sharing options...
MrPhil Posted January 28, 2017 Share Posted January 28, 2017 the product pages titles began with the category name Well, you could do a RewriteCond that matches %{REQUEAT_URI} to ^/categoryname and use that to redirect to the new page. That would be one line. Link to comment Share on other sites More sharing options...
aurelou Posted January 28, 2017 Author Share Posted January 28, 2017 Hmmm ok, I don't really know how to do this, I think I'll stay like this for the moment. Is it bad for the site to have a lot of lines in .htaccess ? Link to comment Share on other sites More sharing options...
MrPhil Posted January 28, 2017 Share Posted January 28, 2017 It will certainly slow down your site a little bit. That's why a single line would be much better if you can figure out a common pattern. By the way, that's REQUEST_URI (typo). Link to comment Share on other sites More sharing options...
aurelou Posted January 30, 2017 Author Share Posted January 30, 2017 Thanks a lot @@MrPhil for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.