Solved

How do I set up a URL rewriter for a Linux-based GoDaddy host (htaccess seems crippled)

Posted on 2010-11-08
6
428 Views
Last Modified: 2012-05-10
I have a Microsoft-based hosting account with GoDaddy currently
and to facilitate redirection I have errors redirected to an ASP script which then rewrites the
URL to point to another host and creates a frame.    I need to consolidate this account with
a Linux account and this is the last thing that needs to be changed before I can transfer.

I have another Linux-based account and have tried to no avail to get an htaccess solution functional,
and am hoping someone here has some experience with GoDaddy's restrictions and implementations.
I don't redirect the entire domain, but I need to redirect (preferably in a frame) URLs as shown:

http://mydomain/e/12345 ->  http://otherdomain/entries/12345
http://mydomain/t/12345  ->  http://otherdomain/tickets/12345

Options +FollowSymlinks
Options -MultiViews
RewriteEngine on
RewriteRule ^/e/([0-9]+) /e/rd2.php?rtype=e&article=$1 [R=301,NC]
RewriteRule ^/t/([0-9]+) /t/rd2.php?rtype=t&article=$1 [R=301,NC]

I think the problem lies in my PHP code for "rd2.php", which I basically pieced together ... So please take
a look at the attached and make / suggest corrections (or rewrite completely).

Note that GoDaddy's mod_rewrite appears to restrict the redirection/rewrite to reference only
files hosted on GoDaddy.

If you have access to a GoDaddy Linux host please test it out to see if it is working prior to
response.  Let me know if I've omitted anything important and I'll try to respond as soon as possible...

Thanks!

P.S. When attempting to do this, I used the following as points of reference:
http://corz.org/serv/tricks/htaccess2.php
http://davidwalsh.name/mod_rewrite-htaccess-godaddy

rd2-ee.php
0
Comment
Question by:joshky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 26

Expert Comment

by:arober11
ID: 34085575
Re your request for rules to handle the following redirects:

http://mydomain/e/12345 ->  http://otherdomain/entries/12345
http://mydomain/t/12345  ->  http://otherdomain/tickets/12345

The following should do / replace the need for your own php code, unless you wish to IFrame the redirect.:

RewriteRule ^/e/([0-9]+)   http://otherdomain/entries/$1  [R=301,NC]
RewriteRule ^/t/([0-9]+)    http://otherdomain/tickets/$1  [R=301,NC]

Note: the above rules will change the URL showing in the browser address bar.
0
 

Author Comment

by:joshky
ID: 34088884
Arober11,
Thanks for the reply.  But, I'm afraid it hasn't proven to be this simple.   This is why I'm hoping someone familiar with GoDaddy Apache Linux hosting will be able to chime in.   I don't know the specifics of WHY this doesn't work, but I've spent quite a bit of time myself tinkering and it has been to no avail.

Thanks in advance for any further comments.
0
 

Author Comment

by:joshky
ID: 34088894
For clarification, if I do try to do as you suggest Arober11, I receive an HTTP/404 error message when attempting to access one of the example URLs.
0
Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

 
LVL 26

Accepted Solution

by:
arober11 earned 500 total points
ID: 34098589
Hi, must apologize, skipped the bit saying your using a .htaccess rather than a httpd.conf based rules. If you using .htaccess rule you need to loose the leading /  from the pattern, as the patten is prefixed with the contents of RewriteBase, before performing the match i.e. The following should work.


Options +FollowSymlinks
Options -MultiViews
RewriteEngine on
RewriteBase /
RewriteRule ^e/([0-9]+)  http://otherdomain/entries/$1  [R=301,NC]
RewriteRule ^t/([0-9]+)  http://otherdomain/tickets/$1  [R=301,NC]




0
 

Author Comment

by:joshky
ID: 34113319
Worked like a charm.  Thanks!
0
 

Author Comment

by:joshky
ID: 34113559
ARober11,
I posted a related question that you may be interested in also ... although this solution is working, it is based on implementation of the PHP portion:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_26608575.html
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question