Php .htaccess URL重写访问
我需要一些帮助。这是原始链接Php .htaccess URL重写访问,php,.htaccess,Php,.htaccess,我需要一些帮助。这是原始链接 http://tester.local/adm/index_pub.php?ch=feondi-event 我希望它是这样的 http://tester.local/feondi_event 在root.htaccess中使用此行 RewriteRule ^feondi_event$ /adm/index_pub.php 这不使用.htaccess,但也适用于: <?php if($_GET['ch'] == 'feondi-event') {
http://tester.local/adm/index_pub.php?ch=feondi-event
我希望它是这样的
http://tester.local/feondi_event
在root.htaccess中使用此行
RewriteRule ^feondi_event$ /adm/index_pub.php
这不使用
.htaccess
,但也适用于:
<?php
if($_GET['ch'] == 'feondi-event') {
header("Location: http://tester.local/feondi_event");
}
?>
重新启动发动机
重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/adm/index_pub.php?ch=$1[L]
感谢您的回复。但当我测试它不工作。更新它请检查现在可能的副本。无论如何,你不能用mod_rewrite来做这件事。您应该手动处理从重写url中提取的文本。你显然错过了一个机会。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /adm/index_pub.php?ch=$1 [L]
</IfModule>