问题可能出在使用htaccess缩短网址中的URL?

问题描述 投票:1回答:1

因此,我正在尝试从以下位置缩短网址:

trel/mycompany.php?company=f4f4f4

to

trel/f4f4f4

使用下一个htaccess规则,如下例所示。最后,我可以通过在网址字段中键入trel/f4f4f4来访问该页面,但是当我使用完整链接访问它时,它不会缩短。

我希望,我提出了一个明确的问题,使我的母语不是英语。

RewriteEngine on 
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !^mycompany.php
RewriteRule ^([^/\.]+)/?$ mycompany.php?company=$1 [L,NC]
php .htaccess url mod-rewrite
1个回答
0
投票

将.htaccess文件中的最后两行替换为下面的行

RewriteEngine开启RewriteRule ^ trel /([[^ /] *)$ /trel/mycompany.php?company=$1 [L]

© www.soinside.com 2019 - 2024. All rights reserved.