htaccess“更改网址”

时间:2014-04-27 08:47:33

标签: asp.net .htaccess redirect

我使用这种网址创建了网站:

  • acma.us/index.aspx
  • acma.us/FreeSaleCertificate.aspx

我已经重新对所有网站文件进行了重新归档,并且我已将FROM" ASPX更改为HTML"现在它就像这样:

  • acma.us/Certificate/index.html
  • acma.us/Certificate/FreeSaleCertificate.html

帮助我这样做:

并告诉我如何将旧网址重定向301到新网址

  • 来自: acma.us/FreeSaleCertificate.aspx
  • 致: acma.us/Certificate/FreeSaleCertificate /

我需要帮助才能完成这个步骤,我不是专家:(

等待有人帮助我:)。

谢谢&最诚挚的问候:)

1 个答案:

答案 0 :(得分:0)

将此代码放入Certificates/.htaccess文件中:

RewriteEngine On
RewriteBase /Certificates/

RewriteCond %{THE_REQUEST} /(?:index)?(.*?)\.html[\s?] [NC]
RewriteRule ^ %1/ [R=301,L,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/Certificates/$1\.html -f [NC]
RewriteRule ^(.+?)/?$ $1.html [L]
相关问题