【问题标题】:How to Rewrite my url from index.php to sample.php如何将我的 url 从 index.php 重写为 sample.php
【发布时间】:2015-01-10 05:16:45
【问题描述】:

我想将我的 url 从 index.php 重写为 sample.php。我怎样才能做到这一点?我不允许将 index.php 重命名为 sample.php 并使其登陆 url。是否使用 .htaccess?

【问题讨论】:

  • IAM 使用 JOOMLA , XAMPP

标签: url url-rewriting seo rewrite


【解决方案1】:

如果你在 linux 上,你可以创建一个符号链接。

ln -s index.php sample.php

在 Windows 上会是:

mklink /D sample.php index.php

【讨论】:

  • 但是,如果您的主机尚未这样配置,您需要将 Options +FollowSymLinks 添加到您的 .htaccess 文件中。
  • 哦,不知道..对我来说它一直有效
  • iam 使用 windows xaamp
  • 嗨,我是 htaccess 的初学者
  • 重定向到 sample.php 页面
【解决方案2】:

只需在 .htaccess 文件中添加这一行:

RewriteRule ^index.php$ sample.php$1 [R=301,L]

【讨论】:

  • 它可以工作,但大家建议不要从 index.php 重写为其他名称。无论如何感谢您的贡献..
猜你喜欢
  • 2013-06-25
  • 2022-08-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多