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
275 views
in Technique[技术] by (71.8m points)

apache - Rewriting adress with a dot - "/." in htccess

I would like to rewrite (301) https://www.myadress.com/. to https://www.myadress.com/ How can I do it? The web browser seems to doesn't see the dot after slash.

I tried

RewriteRule ^.$ https://www.myadress.com/ [L,R=301]

But the code above is not working.

question from:https://stackoverflow.com/questions/65914542/rewriting-adress-with-a-dot-in-htccess

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

1 Answer

0 votes
by (71.8m points)

Based on your shown samples could you please try following. Please clear your browser cache before testing your URLs. These rules will remove any uri present in url and redirect it to base domain url as per your shown samples.

RewriteEngine ON
RewriteCond %{REQUEST_URI} !^/?$ 
RewriteRule ^ https://%{HTTP_HOST} [R=301,L]

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

...