WebFaction
Community site: login faq

I am getting the feeling that I might be setting up a strange configuration of domains, websites, and redirects. It seems like I am doing exactly what the Apache Tutorial says not to in the section 'When (not) to use .htaccess files'. However, I cant find .htaccess in any higher directories.

Is this the preferred method?

  • http://shop.rid-engine.com redirects to https://shop.ride-engine.com - static app with .htaccess mounted on the unsecure url.
  • www.ride-engine.com redirects to ride-engine.com - static app with .htaccess mounted on the www. url

For now, I would like all traffic to be directed to the the secure shop subdomain. Do I create another app for a redirect and mount it on ride-engine.com, as well as modifying all the other .htaccess to point to https://shop.ride-engine.com?

Or is there perhaps some other method entirely?

Thank you

asked 22 Jan '13, 21:14

shipwreck
772714
accept rate: 50%


Using .htaccess for this is OK.

Our documentation covers the suggested way to do this on our platform, it explains what you are explaining above.

Since we use a mixture of nginx/apache/control panel, the official Apache answer does not apply completely.

permanent link

answered 22 Jan '13, 21:30

johns
5.4k412
accept rate: 23%

edited 22 Jan '13, 21:31

For efficiency, is it possible to write a flexible redirect; rather than specifying the origin_domain, is there code that says 'whatever this origin domain is'?

That way one app could be used on multple websites? Or is that totally not the way this works, each website needs its own .htaccess?

(22 Jan '13, 22:54) shipwreck
1

Yes, you can do this easily. First, create a new Static/CGI/PHP application named something like "redirect". Then, point all of the domains which you would like to redirect to this application in your website record. Now, every one of those domains will arrive at the redirect application.

Next, remove the RewriteCond from the redirect code, since it's the RewriteCond which is making the redirect selectively apply to only one domain. In other words, use something like this in your .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://destination_domain/$1 [R=301,L]

Now, every domain which arrives at the redirect application will be forwarded to the destination_domain. There's no need for multiple redirect applications or copying the redirect .htaccess code once for each domain.

Hope that helps!

(22 Jan '13, 23:26) ryans ♦♦

Unreal, you guys are truly amazing. I appreciate your help very much

(23 Jan '13, 00:00) shipwreck
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:

×113
×76
×76
×75

question asked: 22 Jan '13, 21:14

question was seen: 3,595 times

last updated: 23 Jan '13, 00:00

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 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