Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

laravel - .Htaccess index php / html redirect to main page

I have this .htaccess. I would like:

  • That he would direct from www.domena.pl to domena.pl (I have it done) to always point to https
  • after entering domena.pl/index php or index html -> redirected to https domena.pl

How can I make it?

My htacess:

  RewriteEngine On
     # Redirect to non www
     RewriteCond% {HTTP_HOST} ^ www.domena.pl $ [NC]
     RewriteRule ^ (. *) $ Https://domena.pl/$1 [R = 301, L] 
question from:https://stackoverflow.com/questions/65932698/htaccess-index-php-html-redirect-to-main-page

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

1 Reply

0 votes
by (71.8m points)

Redirect to non-www with https:

RewriteCond %{HTTP_HOST} ^(www.)(.+) [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www.)?(.+)
RewriteRule ^ https://%2%{REQUEST_URI} [R=301,L]

To let all routes go to index.php:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...