Solved

301 redirect syntax

Posted on 2015-02-04
4
82 Views
Last Modified: 2015-02-08
Hi,

I am changing website platforms and it appears I will need to be correctly identifying a certain type of URL structure, and redirecting to a new structure, but it's not as simple as what I'm seeing for examples to use in htaccess. In my case, I need to do a couple of things.

I need to change this:

https://www.domain.com/products/category/subcategory/product/154-product-friendly-name

to this:

https://www.domain.com/shop/product-friendly-name

Is there a way to manage this type of redirect using 301?

Thank you

Bill
0
Comment
Question by:billium99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Mark Bullock earned 500 total points
ID: 40590478
Try something like this in httpd.conf with mod_rewrite for Apache:

RewriteEngine on
RewriteRule  ^products/category/subcategory/product/[0-9]+-([^/.]+)  shop/$1  [R=301]

Open in new window


To help debug, you can use RewriteLog, and set RewriteLogLevel high (above 3).
0
 
LVL 1

Author Comment

by:billium99
ID: 40591233
Thanks - this is a WAMP server. Should I be using mod_rewrite or IIS URL rewrite?

Bill
0
 
LVL 13

Expert Comment

by:Mark Bullock
ID: 40591389
IIS has a URL Rewrite module. There is a GUI to import Apache mod_rewrite rules, like the one I wrote above.
0
 
LVL 1

Author Comment

by:billium99
ID: 40597208
Thanks Mark
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question