简体   繁体   中英

I trying to remove folder/folder name from url using htaccess

I want to change the URL
My Url
http://localhost/MotoMate/corporate/company/kenstar My target url will be
http://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]

But it's not working. not changing

Try this code in /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] 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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