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
-
301 Redirects from example.com to store.example.com and then removing store.example.com subdomain
Hi I'm trying to wrap my head around the best approach for migrating our website. We're migrating from our example.com (joomla) site to our existing store.example.com (shopify) site... with the plan to finish the redirects/migration then remove the subdomain from shopify and use example.com moving forward. I've never done this and asking here to see if any harm will come from re-directing example.com URLs to store.example.com URL's then changing the store.example.com URL's to example.com. Right now my plan would run like this: redirect example.com URL's to store.example.com remove subdomain on store.example.com use example.com moving forward. wonder what happens next? Is there going to be any issues here, possible harm to the URL's?
Technical SEO | | Minarets0 -
HTML entity characters in meta descriptions
Is it okay to leave HTML entity characters, such as " in meta descriptions? Will search engines translate these appropriately?
Technical SEO | | ellenu0 -
How to Remove Web Cache snapshot page & other language SEO Title in Google Search Engine?
Hi... Please tell me how to remove web cache link given below. I have changed my SEO title but it can't be changed...Any other methods for without using webmaster tools. Kw3arat
Technical SEO | | Thilak_geo040 -
Link removal from search rank checking sites
I'm going through the link removal process for unnatural links to a site. While I'm able to identify the obvious link profile and seo-article links that Google wants removed, what should we do about the links that are generated by the various seo link investigation and ranking services? Example: http://www.seoprofiler.com/analyze/allamericanfencing.com This site (seoprofiler) automatically creates these links to web sites when it generates its reports. Are those links that need to be removed or disavowed, or will Google not care? I want to err on the side of caution, but don't know how to treat these types of pages. The site didn't ask for or lobby for those links, so it's "natural" in that sense, but they're not editorially earned either (except for happen to be ranking for a similar term). Does anyone have experience on this aspect of the unnatural link grooming process?
Technical SEO | | CHarkins0 -
Site dropped after I removed spammy KW-stuffed section from homepage
An SEO newbie. I took a sabbatical from my site for 10 months for personal reasons & I'm now coming back to it for the first time and facing a number of issues that I'd appreciate some advice on. 1) In the past week, my rankings for my main keywords have suddenly plummeted from ~#7 - #8 to about #25. The only thing I've done in that time is sign up for Google Webmaster Tools and clean up a spammy-looking keyword-stuffed section at the foot of my homepage. (It read: Red keyword | blue keyword | green keyword | yellow keyword ... 20 times). I've kept the links (to internal pages of my site) but removed keywords. I've no social presence whatsoever. No Twitter, Facebook, Digg, G+, Google Places, nothing -- but I can't imagine this is behind the sudden drop. 2) Last year my rankings start to fall in late April. But for the first two months or so the drop was only from #1 to #2 - #3. I put it down to Penguin as my backlink profile is not ideal. About 5 years ago some SEO got me a mass of sitewide blog footer links with exact-match anchors -- some of which still remain. (Some domains have 750-plus links pointing back to my site). I've a sitewide banner (2,500 pages) on a site with a related theme to mine. I've loads of links from article directory sites (from when I knew no better). * Question: In Google Webmaster Tools I have not (yet?) received an unnatural links warning. Should I still clean up the links with the Link Disavow tool?
Technical SEO | | Jeepster0 -
Asking to remove links from other sites
How hard is it to get people to take off links that point to your site that are on theirs? I have about 4 sites that I would like my link OFF of their blogroll because I think I was hit by the penguin update because of that. Do you know if there is anything you can do if they DON'T take it off?
Technical SEO | | SeaC0 -
Will frequently adding and frequently removing pages from my site hinder any SEO?
Hi Guys, Just looking through our crawl diagnositcs and we have a ton errors, well over 5000 actually, on 404 pages that cannot be accessed. Our website runs a lot of "Hot Offers" that are time bound, so they expire at the end of each month and we remove the page via our CMS. It's making the crawl diagnositcs loook bad, but will this be hindering our seo and Google 'stuff' because they are finding thousands of 404 errors? Any advice would be greatly appreciated! Website: www.vospers.com Lee Greenhill
Technical SEO | | lee_greenhill0 -
How do search engines treat urls that end in hashtags?
How do search engines treat urls that end in hashtags? For example, www.domain.com/abc#xyz.
Technical SEO | | nicole.healthline0