我试图使用htaccess从网址中删除文件夹/文件夹名称

编程入门 行业动态 更新时间:2024-10-25 00:35:19
本文介绍了我试图使用htaccess从网址中删除文件夹/文件夹名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想更改URL 我的网址 http:// localhost / MotoMate / corporate / company / kenstar 我的目标网址为 http:// localhost / MotoMate / kenstar

I want to change the URL My Url localhost/MotoMate/corporate/company/kenstar My target url will be localhost/MotoMate/kenstar

**I am using .htacees file:-** RewriteEngine on RewriteBase /MotoMate/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|js|img|css|captcha|robots\.txt) RewriteRule ^(.*)$ /MotoMate/index.php/$1 [L] #AuthType Basic #require valid-user #Allow valid-user #Deny from all #Allow from env=test_uri #Allow from env=live_url #Satisfy any Options +FollowSymLinks -MultiViews # Turn mod_rewrite on Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^corporate/(.*)$ /$1 [L,NC,R] RewriteRule ^company/(.*)$ /$1 [L,NC,R]

但是它不起作用。不变

推荐答案

在 /Moto/.htaccess 中尝试以下代码:

RewriteEngine on RewriteBase /MotoMate/ RewriteCond %{THE_REQUEST} /corporate/company/(\S*)\s [NC] RewriteRule ^ /%1? [R=302,L,NE] RewriteRule !^corporate/company/ corporate/company/$1 [L,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|js|img|css|captcha|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L]

更多推荐

我试图使用htaccess从网址中删除文件夹/文件夹名称

本文发布于:2023-10-31 18:39:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546941.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   名称   网址   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!