Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple redirect with htaccess

I know this is a simple and quick thing, but site is going live within hours and I dont have any experience on htaccess so Im hoping someone could give some quick help with this.

So what I want is that I have html files root folder. Files are index.html, german.html, swedish.html, spanish.html, danish.html. Now I would like to have the URL so that german site would be in www.domain.com/de swedish www.domain.com/sv english/default in www.domain.com/en and so on. This should be possible to do with htaccess right?

Or is there better way to do it?

Thanks alot!

like image 575
samuelvonbonn Avatar asked Mar 13 '11 19:03

samuelvonbonn


People also ask

What is a 301 .htaccess redirect?

What Is a 301 Redirect? A 301 redirect is a permanent redirect. When a user tries to access an old URL, the server sends their browser the 301-Permanently Moved status code and sends them to another page. This is useful for site owners and users because it means they are directed to the next most relevant page.

Should I enable 301 .htaccess redirect?

The . Because the WordPress 301 redirect is not always reliable, we recommend issuing the 301 redirect via your . htaccess file. Another benefit is that the . htaccess redirect is slightly faster than redirecting via PHP, because it is loaded even before the rest of the page.

How do I redirect a URL to another URL?

Redirects allow you to forward the visitors of a specific URL to another page of your website. In Site Tools, you can add redirects by going to Domain > Redirects. Choose the desired domain, fill in the URL you want to redirect to another and add the URL of the new page destination.


1 Answers

Create a .htacess fil with the following contents:

Redirect permanent /german.html http://yourdomain.com/de
Redirect permanent /swedish.html http://yourdomain.com/sv
....

I hope this is what you ment and that it helps :)

like image 129
Philipp Avatar answered Oct 26 '22 16:10

Philipp