繁体   English   中英

在PHP中使用htaccess重写规则

[英]Rewrite rule using htaccess in PHP

在我的应用程序中,我们在一些页面上静态编写根目录名称(游戏),这些页面在GUI中显示为链接。 现在每当我试图点击这些URL时,它会将我重定向到url1,这对我来说是无法访问的。 那么有什么方法可以访问url1而不会在整个应用程序中删除这样的静态名称?

网址1:

http://abc:8089/gaming/app/test/unique_testing.php

网址2:

http://abc:8089/app/test/unique_testing.php

我已经尝试了一些htaccess覆盖规则,但它对我不起作用。 我目前的htaccess如下所示:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^gaming(/.*|)$ /$1 [L,NC]

结构体 :

  /var/www/html/gaming/app/test/unique_testing.php
  /var/www/html/gaming/.htaccess                

在root /gaming./.htaccess你可以使用这个规则:

Options +FollowSymLinks -MultiViews
RewriteEngine On

RewriteRule ^app(?:/.*)?$ /$0 [L,NC]

请在.htaccess中使用此规则

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^app/(.*)$ /$1 [L,NC,R]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM