简体   繁体   中英

redirect the URL https://www.domain.com into https://www.domain.com/

I want to add the trailing slashes at the end of the domain name.

For example, redirect from https://www.eatonline.dk to https://www.eatonline.dk/

You can keep you dynamically changing URL in an variable and can add the slash at the end

For example : var URL = "www.eatonline.dk" (You can assign the value as dynamically here ). url = url + "/"; Now the URL variable will have the value as "www.eatonline.dk/" which is still an link.

Try this to add trailing slash to all urls

RewriteEngine On
RewriteCond %{HTTPS} !off
RewriteRule (.*) https://%{HTTP_HOST}/$1$2/ [L,R=301]

it will redirect:

https:// www.eatonline.dk > https:// www.eatonline.dk/

and also

https:// www.eatonline.dk/test > https:// www.eatonline.dk/test/

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