How to remove .html ending with mos rewrtie
-
I have a page and I want to remove .html ending from urls. What should I write in the htaccess?
-
neither works for me. my urls are still in domain.com/file.html format
-
Did you try this?
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
or to add a trailing slash:
`RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.html
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.htmlRewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]`
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Do robot.txts permanently affect websites even after they have been removed?
A client has a Wordpress blog to sit alongside their company website. They kept it hidden whilst they were developing what it looked like, keeping it un-searchable by Search Engines. It was still live, but Wordpress put a robots.txt in place. When they were ready they removed the robots.txt by clicking the "allow Search Engines to crawl this site" button. It took a month and a half for their blog to show in Search Engines once the robot.txt was removed. Google is now recognising the site (as a "site:" test has shown) however, it doesn't rank well for anything. This is despite the fact they are targeting keywords with very little organic competition. My question is - could the fact that they developed the site behind a robot.txt (rather than offline) mean the site is permanently affected by the robot.txt in the eyes of the Search Engines, even after that robot.txt has been removed? Thanks in advance for any light you can shed on the situation.
Technical SEO | | Driver720 -
I am getting html validation errors on my schema, is there something I've done incorrectly?
When I tried to validate my html after added some schema, I am getting html validation errors. I have some examples below. Any ideas on what I've done incorrectly? www.mexpro.com Line 9, Column 80: there is no attribute "itemprop" `…ontent="http://www.mexpro.com/mexico/images/mexpro-logo.jpg" itemprop=**"**logo" />`_L Line 130, Column 23_: "itemscope" is not a member of a group specified for any attribute `itemtype="http://schema.org/Organization">`
Technical SEO | | RoxBrock0 -
How to remove the duplicate page title
Hi everyone, I saw many posts related to this query.But i couldnt find a solution for my error.. Here is my question I got 575 Duplicate page title & 600 duplicate page content errors. My site is related to realestate. I created a page title like same sentence differs with locality name Eg: Land for sale - kandy property Land for sale - Galle property Likewise Locality name only differs..I have created meta title & Content like this. Can anyone let me know how to solve this error ASAP ?
Technical SEO | | Rajesh.Chandran0 -
Remove 404 errors
I've got a site (www.dikelli.com.au) that has some 404 errors. I'm using Dreamweaver to manage the site which was built for me by I can't seem to figure out how to remove the 404 pages as it's not showing up in the directory? How would I fix this up?
Technical SEO | | sterls0 -
Removing 301 Redirects
Is it safe to remove old 301 Redirects from an SEO standpoint and can 301s dramatically affect seo? Prior to switching our old domain over to our new domain, we had (and currently still do) tons of 301 redirects, because of optimizing our file names and structure. Then our old domain was redirected to our new domain in the same redirect file. So that being said, now that our new domain has been up and running for about 3 months, would it be safe for me to get rid of the old 301 redirects and redirect anything that was on our old domain to our new domains home page? This would clean up our redirects tremendously and I hope would help with SEO.
Technical SEO | | hfranz0 -
Php to html - change in extension
Hello, What is the code to redirect all the pages of a site from .php to .html extension? Thanks
Technical SEO | | seoug_20051 -
Is it ok to just use the end of the url when using a Rel Cononical Link?
Hi, I am working with an account and the previous SEO used a Rel Canonical link that just uses the end of the url. Instead of the full url When I look it up on the web I see most people are using the full url. Is that the proper way to do it or does is suffice to just use the end of the url? Wanted to check before I take the time to change them all. -Kent
Technical SEO | | KentH0 -
Does removing product listings help raise SERP's on other pages?
Does removing content ever make sense? We have out of stock products that are left on the site (in an out of stock section) specifically for SEO value, but I am not sure how to approach the problem from a bottom line conversion stand point. Do we leave out of stock products and hope that they turn into a conversion rate via cross selling, or do out of stock products lower the value of other pages by "stealing" link juice and pagerank from the rest of the site? (and effectively driving interest away) What is your perspective? Do you believe that any content that is related or semi-related to your main focus is beneficial, or does it only make sense to have strong content that has a higher rate of conversion and overall site engagement?
Technical SEO | | 13375auc30