0

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

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?

1

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 http://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.

| improve this answer | |
  • I mean new 301 /blog/ will know that all requests coming for blog posts located on old /blog-domain-name/ are coming exactly for blog posts and not something else? Will /blog/ know how to properly redirect old blog posts to their new destination? – Boris_yo Jun 30 '14 at 9:00
  • Does not work and I get: Bad karma: we can't find that page! – Boris_yo Jun 30 '14 at 9:03
  • I think /blog-domain-name/blog-post.html is permanent location and I need to not redirect but change URL. I don't know how to do that in Joomla 1.5 – Boris_yo Jun 30 '14 at 9:04
  • Yes, it does sound like you need to change the URLs on your site and not redirect after all. Trying to redirect to the new location that does not exist is not going to help you! You could partially solve this with an internal rewrite, but you are still going to have to (or rather, "you should") change all the URLs that point to those pages... (although that could perhaps be solved with a redirect, but now it's getting messy) so, yes, you really need to change the URL structure in your CMS (ie. Joomla). – MrWhite Jun 30 '14 at 10:07
  • 1
    To my Knowledge you cannot use a redirect when a page is created during a Database Query, regardless of CMS. It's the database that determines the page location, not the directory structure. – eyoung100 Jun 30 '14 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.