*This question is unique because I do not need to remove the .html from the file extensions; I need to have internal links function correctly.
*这个问题很独特,因为我不需要从文件扩展名中删除.html;我需要正确的内部链接功能。
My site is http://purplerosecare.com and I tried creating a .htaccess page with the suggested copy/paste from the SO page: How to remove .html from URL
我的网站是http://purplerosecare.com,我尝试使用SO页面中建议的复制/粘贴创建一个.htaccess页面:如何从URL中删除.html
The code I used is below:
我使用的代码如下:
RewriteEngine on
RewriteBase /
RewriteCond %{http://www.proofers.co.uk/new} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ http://www.proofers.co.uk/new/$1 [R=301,L]
(The code & .htaccess have both been removed)
(代码和.htaccess都被删除了)
The problem I'm facing is whenever I click on a link in the navigation it sends me to http://www.proofers.co.uk/new/. How can I get the site functional again?
我面临的问题是每当我点击导航链接时,它就会发送给我http://www.proofers.co.uk/new/。如何让网站再次正常运行?
1 个解决方案
#1
Try this in your Root/.htaccess file
在Root / .htaccess文件中尝试此操作
#Remove html extensions from files
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*?)/?$ $1.html [L]
#1
Try this in your Root/.htaccess file
在Root / .htaccess文件中尝试此操作
#Remove html extensions from files
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*?)/?$ $1.html [L]