Redirecting blog page URLs

I’ve set up a blog using Alloy. It works great and looks good.

I’ve got the blog in two places on the same site (a smaller more restricted list of articles on the front page and the full works on a specialised blog page). Whichever page you are on it pulls up the article and displays it correctly. I’m also using pretty-urls. However, the webpage URL is determined by which webpage you are viewing the article from.

For example mywebsite/main/blog-article-name OR mywebsite/blog/blog-article-name. I wonder if it is possible to redirect the former to the latter (so it always ends up on mywebsite/blog/blog-article-name) using .htaccess

The reason I’m looking at this is to add a Disqus stack - it won’t work properly with the two different URLs.

I have tried the following:

RewriteRule ^main/(.*)$ /blog/$1 [R=301,NC,L]

However, it also diverts the /main page (i.e. no alloy blog displayed) as well which I don’t want.

(I know I can use the ‘recent posts’ Alloy stack - however, although it allows a summary it does allow for the topper image to be displayed and has limited formatting options.)

Any help would be much appreciated.

From your description it sounds like you’ve placed a Blog Entries stack on two separate pages. Any page you where you place a Blog Entries stack you are creating a separate blog instance. You may be pointing both separate blogs to the same set of blog posts, but they are separate blogs. This is why they use their own folder names for accessing the posts, as they are separate blogs.

Hi Adam,

Thanks, I did have two separate blogs (albeit with the same database of posts) - I’ve worked out how to use CSS to reformat how the recent posts Alloy stack displays it’s summaries so I’ve gone along this route. I’ve added the Disqus stack to the blog posts now and it’s working smoothly.

:slight_smile:

Alloy v3 has Disqus commenting built in so you don’t need to use the Disqus stack any longer. There’s a video on the tutorials page, toward the bottom, about commenting: Alloy Tutorials

Oh yes - so there is!!! I’d forgotten it had been added. :man_facepalming: Fortunately it’s been a quick job to swap it over. Thank you.

1 Like