WebFaction
Community site: login faq

Hi everyone,

I'm trying to follow the instructions given here, with the goal of redirecting http://www.example.com to http://example.com.

http://docs.webfaction.com/software/static.html#redirect-a-domain-with-a-static-cgi-php-app

The problem is that there was no .htaccess file in my /app_name directory (the one created during the process). I then created an .htaccess file and pasted in the code, all correct, and put it in the app_name/ directory.

The results were that it was displaying the hello world index.html page that was automatically created in the app_name category. I deleted that index.html page, and then I didn't get anything, certainly not a redirect.

In summary, in the admin > domains, I made "www.example.com". I then created a website named redirect, and I selected the "www.example.com" domain. I then created a static app, according to the instructions. On the website named redirect, I selected the static app to serve the redirect website. Then I found there was no .htaccess file in the directory, so I made one. It didn't work.

Thanks,

Robert

asked 21 Mar '14, 20:40

madnessitself
1112
accept rate: 0%


You should have created the .htaccess file if it did not exist, so that is fine.

Were you using a tool which does not cache to check the result? 301 redirects will cache in the browser.

Please paste the real domain and the exact code you have in the .htaccess file here so we can see it, or send us a support ticket so we can see the account directly.

permanent link

answered 21 Mar '14, 23:36

johns
5.4k312
accept rate: 23%

edited 21 Mar '14, 23:36

I'll take the support ticket route, so the whole forum can't see the mess I've managed to make here. But then we can post the answer in the forum so people know what happened.

permanent link

answered 21 Mar '14, 23:46

madnessitself
1112
accept rate: 0%

Alright, I got it figured out on my own.

In the documentation, it's not really clear where to include the http:// and where not to.

If you are going from www.example.com to http://example.com, it should look like this:

Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^www.example.com$ [NC] RewriteRule ^(.*)$ example.com/$1 [R=301,L]

It should not look like this:

Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^http://www.example.com$ [NC] RewriteRule ^(.*)$ example.com/$1 [R=301,L]

I think I made the mistake because I simply flipped the documentation example around in my head.

Thanks!

permanent link

answered 22 Mar '14, 01:33

madnessitself
1112
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×76
×33
×31

question asked: 21 Mar '14, 20:40

question was seen: 2,983 times

last updated: 22 Mar '14, 01:33

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM