Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

301 redirect syntax

Posted on 2015-02-04
4
Medium Priority
?
85 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 14

Accepted Solution

by:
Mark Bullock earned 2000 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 14

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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 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