【发布时间】: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
我想将我的 url 从 index.php 重写为 sample.php。我怎样才能做到这一点?我不允许将 index.php 重命名为 sample.php 并使其登陆 url。是否使用 .htaccess?
【问题讨论】:
标签: url url-rewriting seo rewrite
如果你在 linux 上,你可以创建一个符号链接。
ln -s index.php sample.php
在 Windows 上会是:
mklink /D sample.php index.php
【讨论】:
Options +FollowSymLinks 添加到您的 .htaccess 文件中。
只需在 .htaccess 文件中添加这一行:
RewriteRule ^index.php$ sample.php$1 [R=301,L]
【讨论】: