Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
327 views
in Technique[技术] by (71.8m points)

.htaccess - How to add /eu in url if it doesn't exists and then remove from url but show on browser url

I want to add /eu after domain name in url and then remove it from URL but in browser url it should display /eu... Here is my .htaccess rewrite rule

RewriteCond %{REQUEST_URI} !^/eu [NC] ##This condition checks if eu available or not URL
RewriteRule ^ eu%{REQUEST_URI}        ##This line will add eu if it is not in URL
RewriteCond %{REQUEST_URI} ^/eu       ## This line will check eu is in url or not.. logically it should always return true because i have added /eu in url in previous line
RewriteRule ^eu(/.*)?$ $1 [P] ##this line should remove /eu from url but it will display in url

My question is if i added /eu in second line then why third line condition is failing ?

I checked rule with this website https://htaccess.madewithlove.be.... I have given url localhost/testproduct and output is

RewriteCond %{REQUEST_URI} ^/eu This condition was not met. whereas i have added /eu in second line.. Please help in this. thanks

question from:https://stackoverflow.com/questions/66058603/how-to-add-eu-in-url-if-it-doesnt-exists-and-then-remove-from-url-but-show-on

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...