catching old html files in htacess redirect

Permalink
Hi

I have moved from an old site which was HTML based to C5.

Is there a way I can catch the old html urls and links so /about.html redirects to the new /about page.

Seen its do-able in htacess file but not sure how.

Any help would be massively appreciated

Thanks, Matt

Matteld80
 
hutman replied on at Permalink Reply
hutman
I would suggest using this package from the Marketplace, it makes setting up redirects really easy and you don't have to mess with your .htaccess file.

http://www.concrete5.org/marketplace/addons/seo-301-redirects/...
Matteld80 replied on at Permalink Reply
Matteld80
We have this installed and set up but it doesn't re-direct the html links to the new pages unless I'm not using it correctly?

From what I've read up its a regular expression we need, I just dont have a clue how :)
hutman replied on at Permalink Reply
hutman
That block should setup the redirect for you, so it goes to the correct page when it hits your site.

If they are all simple URLs like your example you can also add about.html to the More URLs section of the Page Properties.
hutman replied on at Permalink Best Answer Reply
hutman
If you really want to do it with the .htaccess I think you can use this

RedirectMatch 301 (.*)\.html$ http://www.example.com$1


replacehttp://www.example.com with your URL, haven't tested this, but it should be what you are looking for.
Matteld80 replied on at Permalink Reply
Matteld80
Beautiful... does exactly what I needed.

Also thanks for the page paths thing, I never thought to add .html into there

Thanks a lot hutman :)

This is why I love the C5 community
Matteld80 replied on at Permalink Reply
Matteld80
Hi hutman

The propblem seemed to have sorted out the internal pages but when you go to the homepage it was putting on /index

Any ideas why? Heres my htaccess code

# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
# -- concrete5 urls end --
RedirectMatch 301 (.*)\.html$ http://www.saloukee.com$1
#Compression routines
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/x-js text/x-javascript application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html


Cheers, Matt
hutman replied on at Permalink Reply
hutman
What that chunk of code does is takes any thing with a .html extension, strips the extension and redirects the page. This is ALL .html pages, including the index.html. My suggestion would be to add an alternate URL for the Home page as /index and it should redirect to /
Matteld80 replied on at Permalink Reply
Matteld80
ok if I do that i get This webpage has a redirect loop error message
hutman replied on at Permalink Reply
hutman
Before adding that alternate URL did it get to the right place but just with /index in the URL?
Matteld80 replied on at Permalink Reply
Matteld80
Before no with yeah