/    Sign up×
Community /Pin to ProfileBookmark

301 Redirect

Hello,

what do I need to put in my .htaccess file for the following scenarios.

For all 3 cases:
http://domain.net // case http without www
http://www.domain.net // case http with www
https://www.domain.net // case https with www

user is redirected to:
https://domain.net

All subdirs & parameters are kept after “.net/” such
https://domain.net/subdir/

Thanks,
K.

to post a comment
SEO

8 Comments(s)

Copy linkTweet thisAlerts:
@KalemauthorJun 17.2018 — I just find the solution and want to share with you:

https://www.j-26.com/blog/how-to-redirect-to-or-away-from-www-and-http-s/
Copy linkTweet thisAlerts:
@rootJun 18.2018 — Try posting the code you already have and someone will tell you what you need to do.
Copy linkTweet thisAlerts:
@VITSUSAAug 11.2018 — Mentioned hyperlink will be more useful to understand 301 redirect.

https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file
Copy linkTweet thisAlerts:
@tamil96Aug 24.2018 — By adding code in . htaccess file you can give 301 redirection.
Copy linkTweet thisAlerts:
@efusionworldSep 15.2018 — 301 redirect is an HTTP status code indicating URL been permanently redirected. It is also recommended by Google and Bing for permanent redirection as it is shown in search engine results.
Copy linkTweet thisAlerts:
@RH-CalvinSep 17.2018 — 301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It's not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it's the safest option. The code "301" is interpreted as "moved permanently".
Copy linkTweet thisAlerts:
@rootSep 17.2018 — {"locked":true}
Copy linkTweet thisAlerts:
@rootSep 17.2018 — *locked as OP has the answer already*
×

Success!

Help @Kalem spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...