htaccess help please

aidan1980

Free Member
Jan 16, 2008
1,321
149
Leicester
Hi

I have a site that I've now got on a https: so obviously a 301 redirect was put in from http
Trouble is i have pages that are duplicate as well ..co.uk/redreview.htm and ..co.uk/redreview

here is my htaccess code

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.htm -f
RewriteRule ^(.*)$ $1.htm


# RewriteBase /
# RewriteRule ^(.*)\.htm $1 [R=301,L]

RewriteEngine on
rewritecond %{http_host} ^freebetsonline.org.uk [nc]
rewriterule ^(.*)$ hxxp://wxw.freebetsonline.org.uk/$1 [r=301,nc]


RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) hxxps://%{HTTP_HOST}%{REQUEST_URI}

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.htm -f
RewriteRule ^(.*)$ $1

#RewriteCond %{THE_REQUEST} \.htm
#RewriteRule ^(.*)\.htm$ /$1 [R=301,L]

-----------------------------------------------------------------------------------------------------------------
Would someone mind showing me what is should be please so all http 301s to https and all .htm versions go no none .htm

obviously I edited the code so it didnt hyperlink out here
 
Sorry your right, please try this:

Options +FollowSymlinks

RewriteEngine on
rewritecond %{http_host} ^freebetsonline.org.uk [nc]
rewriterule ^(.*)$ hxxp://www.freebetsonline.org.uk/$1 [r=301,nc]

RewriteCond %{HTTPS} !on
RewriteRule (.*) hxxps://%{HTTP_HOST}%{REQUEST_URI}

#example.com/page will display the contents of example.com/page.html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.htm -f
RewriteRule ^(.+)$ $1.htm [L,QSA]

#301 from example.com/page.html to example.com/page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.htm
RewriteRule ^(.*)\.htm$ /$1 [R=301,L]
 
Last edited:
Upvote 0
You still have your internal links pointing to /page.htm rather than /page so this needs to be sorted too.

Troubleshooting the .htaccess without being able to test it is going to be a pain, especially when you cannot see what other setting exist in the httpd.conf.
 
Upvote 0
i know i have to change them but the 301 redirect will handle that anyway

where will i find the httpd.conf file? can't see it

Edit - just searched for it and no results came up
 
Upvote 0

Latest Articles