2

我有一个 HTML 页面。假设网址是

http://localhost/local/local.html 

但我想将 URL 屏蔽为

http://localhost/local/abc

我们可以这样做吗?

4

3 回答 3

1

.htaccess在您的域的根目录中创建一个文件,并在该文件中添加以下内容:

RewriteEngine On
RewriteRule ^local.html$ http://localhost/local/abc/ [R=301,L]
于 2016-08-02T11:11:16.467 回答
0

.htaccess添加行中:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*) index.php?query=$1 [QSA,L]

当您访问https://localhost/local/abcindex.php解析$_GET["query"]您想要的方式。

于 2016-08-02T11:11:19.303 回答
0

您可以使用htaccess规则实现所需的操作,

在以下位置了解 htaccess:

什么是 .htaccess 文件?

.htaccess您可以实施的规则如下:

Options +FollowSymlinks
RewriteEngine on
rewriterule ^local/local.html (.*)$ http://localhost/local/abc$1 [r=301,nc]
于 2016-08-02T11:18:34.450 回答