Question

I have many URLs like this:

http://blog.domain.org/blog/bid/365332/a-page-here

The number folder after "bid" changes and is random for every URL and "a-page-here" is different for every URL.

I need the regex to direct this type of URL to the following:

http://www.domain.org/blogs/a-page-here

Any help is appreciated as I do not know where to begin with this regex expression.

Was it helpful?

Solution

In the document root of your "blog.domain.org" domain, add:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^blog\.domain\.org$ [NC]
RewriteRule ^blog/bid/[0-9]+/(.*)$ http://www.domain.org/blogs/$1 [L,R]

to redirect.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top