Mobile app version of vmapp.org
Login or Join
Murray432

: How to wildcard 301 redirect inner blog so all current posts work with new blog name? Say I have the following: http://example.com/blog-domain-name/blog-post.html I want it like this: http://example.com/blog/blog-post.html

@Murray432

Posted in: #301Redirect #Blog

Say I have the following:
example.com/blog-domain-name/blog-post.html

I want it like this:
example.com/blog/blog-post.html

Can I do this with a simple 301 redirect using wildcard without complex apache mod_rewrite?

Like /blog-domain-name/* /blog/*

Will new blog URL know that I want all requests arriving at destination blog posts?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray432

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

You can use a mod_alias redirect. If using Apache 2.2.6+ then:

Redirect 301 /blog-domain-name /blog


Everything after /blog-domain-name is appended onto the end of the destination URL, no wildcard is necessary.

On earlier versions of Apache you will need to specify an absolute destination URL:

Redirect 301 /blog-domain-name example.com/blog


Will new blog URL know that I want all requests arriving at destination blog posts?


Not sure what you mean by this? Isn't the "new blog URL" the "destination blog"? The "new blog URL" won't know whether the request has been redirected or not.

UPDATE: From comments, it seems that the actual requirement is to change the URL structure. The "new blog name" (ie. the destination URL) does not currently exist and results in a 404. A simple 301 redirect is therefore not appropriate in this instance.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme