How redirect URL to to file In Cyberpanel and OpenLitespeed

How can I redirect URL to to file In Cyberpanel and OpenLitespeed?

to

I used this code inside /vide directory, but is not working

RewriteEngine on
RewriteCond %{HTTP_HOST} ^dl\.mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.dl\.mydomain\.com$
RewriteRule ^vid\/?$ "https\:\/\/mydomain\.org\/myfile\.zip" [R=301,L]
1

1 Answer

to

Aside: Note that if /vid is a physical directory then you should be requesting /vid/ (with a trailing slash), otherwise mod_dir will issue a 301 redirect to first append the trailing slash.

The RewriteRule pattern matches the URL-path relative to the directory that contains the .htaccess file. So, if "this code inside /vide directory" (although I assume you mean /vid?) then this should be omitted from the URL-path you are trying to match.

For example:

# /vid/.htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?dl\.example\.com [NC]
RewriteRule ^$ [R=301,L]

Note that you used .com in your example, but .org in your rule. I'm assuming this should be .com.

There is no need for all the backslash-escapes in the substitution string (2nd argument to the RewriteRule directive) - this is an "ordinary" string, not a regex (but even if it was, colons and slashes wouldn't need to be escaped). (This is very cPanel-esque).

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like