Changing Canonical URL / Rewrite Rule for One Page

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Locked
lewishowles
Forum Members
Forum Members
Posts: 52
Joined: Tue Oct 25, 2011 4:45 pm

Changing Canonical URL / Rewrite Rule for One Page

Post by lewishowles »

Hopefully this is possible!

I'm using CMSMS 1.9.4.1 on this specific site, and the client wants a new blog page adding. I'm going to be using CGBlog (1.8.1), so that's no problem.

However, they've also requested that the URL for the blog is just /blog (and not /blog.html).

I could probably detect the page in the menu code and rewrite the link for it, but the canonical will still read blog.html, won't it?

I was wondering if there was a way around this for this particular page only.

I suppose the easiest thing would be to have no extension in the config file, but the site has been around for a while now and they've built up decent external links.

If I did do this, how would I add to the htaccess file to 301 redirect all of the .html versions to the non-html versions? My current rewrite rule is as follows:

Code: Select all

# CMSMS Rewriting
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Hopefully I've explained that properly. Thanks!
Locked

Return to “The Lounge”