Jump to content

Recommended Posts

Posted

This may go elsewhere, but I couldn't tell which would fit best, so since it was blog-related, here it goes.

 

I just redesigned my site's structure so that my blog is in http://www.domain.com/blog'>http://www.domain.com/blog instead of http://www.domain.com.

 

The problem is that now all of my archive links that people have linked to are broken (since there is a "/blog" inserted between the domain and archive folders).

 

I know regex can probably handle this kind of thing and there is probably something I can do in my .htaccess file to make an automatic rewrite of the requested URL happen. I just don't know enough about regex to figure it out. I've tried learning on my own, but it's gone over my head.

 

Can anyone help me insert the "/blog" into any http request for a URL that starts with http://www.domain.com/archives/x/y/z/ so that it ends up being http://www.domain.com/blog/archives/x/y/z/?

 

Note that the URL string after archives/ will change with each entry, but is predictable up to archives/, that makes any sense.

 

Thanks,

 

Robert

Posted

I believe adding the following to the .htaccess file in your public_html directory will do what you want:

>RewriteEngine on
RewriteBase /
RewriteRule ^archives(.*) /blog/archives$1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...