• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

htaccess Redirect / Rewrite questions

Question

M_Lyons10    454

Hi everyone!

 

I have a simple html site that I'm trying to make some changes to through the htaccess file.  This is a little outside of my comfort zone, so I wanted to ask on here what recommendations everyone has.

 

I obviously don't want to negatively impact the site's SEO...

 

The htaccess file already redirects from the non www to the https://www site.

 

I'm looking to change the file name of two pages, so I wanted to set up a 301 redirect from these old pages to the new.  However, this doesn't seem to work for some reason and I seem to be doing what every tutorial and discussion online suggests.

 

Next, I want to use the RewriteEngine to get rid of the html file extension.  While the code I have allows me to browse to the page without the html, it does not redirect the traffic from the old page to the new page.  I thought that it would?

 

Here's what I have now for the htaccess file.  Does anything look wrong to anyone?  Does anyone have any suggestions for doing this? 

 

#Permanent Redirects
Redirect 301 /24_7_page.html https://mysite.com/24-7-page.html
Redirect 301 /24_7_pagefaq.html https://mysite.com/24-7-pagefaq.html

 

#Redirect from WWW to non WWW
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.mysite.com [NC]
RewriteRule ^(.*)$ https://mysite.com$1 [L,R=301]

 

#Remove .html
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

 

I would also like to have the website not show https://mysite.com/index in the browser, but I haven't gotten to that yet.

 

Thanks!

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.