- 0
htaccess Redirect / Rewrite questions
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Similar Content
-
Question about redirects (http://www to https://non-www)
By M_Lyons10,
- windows
- web.config
- (and 1 more)
- 7 answers
- 2,591 views
-
- 3 answers
- 2,903 views
-
- 11 answers
- 4,117 views
-
google is showing wordpress sitemap in search results
By Hussam Al-tayeb,
- 5 answers
- 1,871 views
-
- 2 answers
- 1,663 views
-
Question
M_Lyons10
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!
Link to comment
https://www.neowin.net/forum/topic/1366964-htaccess-redirect-rewrite-questions/Share on other sites
0 answers to this question
Recommended Posts