Need a help on .htaccess

I want to do 3 things:

  1. My website URL will always start with https:// and without www (ie. no matter if it is typed with or without .

  2. if someone types then it will become

  3. if someone types then it will become .

  4. and no 3. will happen only for artist and help subdomain, not for others (such as will not become

I need full .htaccess code . I have no idea on .htaccess . can someone kindly do that for me? (The whole code plz, which I can copy paste). I believe it will be a few sentence but this will help me a lot . Thanks in advance.

Hello there,

Try these:

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

For 2, 3 and 4:

Redirect 301 /old-dir

You may also try this if the above code doesn’t work:

RedirectMatch 301 ^/old-dir/$

While I’m not sure for 2, 3 and 4 but it’s worth a try. It’s up to you to make sure that the code will have the correct informations you want.

Should I separate these codes with a comma? or just simply type them one after another?

Bro, another question, will it take some time to effect? or will effect immediately?

I wanted this to happen only when the link is =>
and for =>
not for all links. if the link is , it will remain same as, no change.
I have 2 subdomain, which will be redirected but not for other cases.

One after another will be fine just make sure to leave a space.

It will take effect immediately just make sure to clear your browser cache.

That’s absolutely hard for me, I’m not that of an expert with .htaccess as well but you may try to search some documentations, blog and etc. online to find what you are looking for.

1 Like

Thank you brother. Have a nice day! <3

I want exactly opposite to this question.

Still thanks a lot.

Found an answer .htaccess - Redirect directory to a subdomain - Stack Overflow . But here is a small difference,
They taught how to make
but I want
Please check it once more, I really appreciate your help brother

As far as what I understand is when you insert this code:

RewriteRule ^(video/.*)$$1 [R=301,L,NC]

Is that every files in that subdirectory will permanenently moved/redirect to

As far as what I understand with that rule, this is what I think would happen:
Example 1: will permanently redirect to

Example 2: will permanently redirect to

Example 3: will permanently redirect to

And this is what you would also like right?
If so then that htaccess rule is what you just need.

1 Like

Problem solved. Thank you brother. Have a nice day! <3 I really appreciate your help.

Redirection from subdir to subdomain – for All URLs
From –{article-url}
To –{article-url}

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^
RewriteRule ^mydir/(.*)$$1 [L,R=301]

Best of luck and keep doing good works and stay safe during corona virus <3

1 Like

You’re welcome and stay safe as well :slight_smile:

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.