Changing Canonical URL / Rewrite Rule for One Page
Posted: Mon Feb 13, 2012 9:50 am
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:
Hopefully I've explained that properly. Thanks!
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]