【问题标题】:I want to make seo friendly url using .htacess, my webpages are in php, I want to make it .html extension [duplicate]我想使用 .htaccess 制作 seo 友好的 url,我的网页是 php,我想让它成为 .html 扩展名 [重复]
【发布时间】:2014-08-18 16:07:44
【问题描述】:

我正在使用 xampp 在我的本地主机中开发一个网站。我想制作这样的 SEO 友好 url。

目前我访问这样的页面, http://example.com/myproject/page.php?id=10

我想改变如下, http://example.com/myproject/page.html?id=10

我尝试使用 .htaccess,但有时我发现它重定向到 .php,但我不喜欢这样。我需要永久修复。因此,当用户键入 .html 时,它将访问 .php 文件,但浏览器上的扩展名不会改变。

【问题讨论】:

  • 您提议的更改对 SEO 没有好处。
  • page.html?id=10 ,如果您将扩展名设置为 .html ,那么使用 GET 毫无意义。

标签: php .htaccess


【解决方案1】:

试试这个

RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php

当您访问 page1.html 时,系统会查找:page1.php

【讨论】:

    猜你喜欢
    • 2013-02-09
    • 1970-01-01
    • 2011-05-09
    • 1970-01-01
    • 2015-02-23
    • 1970-01-01
    • 2013-06-25
    • 2022-11-27
    • 2015-11-09
    相关资源
    最近更新 更多