We make tools that make websites.

Forums (Archived)

The Solspace Support Forums are now CLOSED (read-only)

Check out our new support options here. Please refer to this blog post for more information.

   

.htaccess and subdirectory method

Rank

Total Posts: 2

Joined: May 17, 2010

PM

Ignore

 

Hello,

I have been using this addon for a while with the default base url of the domain site. I decided to go ahead and purchase a short domain to use instead. Do you have a tutorial on setting up the .htaccess file to properly redirect the short url to the long domain url? I do not want to park the short url on the domain.

The public directories of my domain sit in a public_html folder. Within this folder I need to place the short url domain subfolder.

In an earlier thread, there is a mention of copying the index.php and path.php files of the main site to the short url folder. But, there is no path.php file I could find in EE2.

There are also different variations on doing the .htaccess file.:

RewriteEngine on
RewriteRule 
^/?$ http://domain_name.com [L]
RewriteRule ^(.*)$ http://short.co/$1 [R=301,NC] 
RewriteEngine on
RewriteCond 
%{HTTP:Host} ^short \.co$
RewriteRule (.*) http\://domain_name\.com$1 [NC,R=301] 

I think the second is the one I would use. Correct?

Do you have any suggestions on how to do this with .htaccess, a separate directory within the public_html folder of the main site and Solspace Shortcut?

I am unfamiliar with crafting .htaccess rewrite rules.

Thanks in advance.

Jose Riveros

EE 2.1.4
Shortcut 1.1.1
Bridge 1.1.5

Avatar
RankRankRankRankRank

Total Posts: 13708

Joined: Oct 18, 2006

PM

Ignore

 

Hi Jose,

Sorry for the delay…

To get this to work you’ll have to park the domain ontop of your main domain. smile

Signature

Rank

Total Posts: 2

Joined: May 17, 2010

PM

Ignore

 

What I did is as follows:

1) drop the short_url folder in my main site’s public_html folder as per my hosting company’s policy for secondary domains.

2) point my short_url domain name to webhost’s servers.

3) create the following .htaccess file in my short_url folder:

RewriteEngine on

RewriteCond 
%{HTTP_HOST} ^short.co[NC]
RewriteRule 
^(.*)$ http://maindomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.short.co[NC]
RewriteRule 
^(.*)$ http://maindomain.com/$1 [R=301,L] 

I don’t believe it is equivalent to parking the short_url domain ontop of the main domain, but it works.

Thanks.

Avatar
RankRankRankRankRank

Total Posts: 13708

Joined: Oct 18, 2006

PM

Ignore

 

Cool, thanks for sharing smile

Signature