Closed Thread Icon

Topic awaiting preservation: .htaccess, Mod_Rewrite, PHP, addon domains, and I need help! :) (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=24659" title="Pages that link to Topic awaiting preservation: .htaccess, Mod_Rewrite, PHP, addon domains, and I need help! :) (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: .htaccess, Mod_Rewrite, PHP, addon domains, and I need help! :) <span class="small">(Page 1 of 1)</span>\

 
robur
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Jan 2005

posted posted 01-11-2005 20:56

Hello everyone!

I need some help with adding a second domain to point to a subdomain on my website. How my site currently works is:

1) a visitor to my site visits a page, such as allthingsinteresting.com/classifieds/browse-cat-54.htm
2) Apache, before looking for the page (which does not exist), find's the following lines of code in a .htaccess file located in my sites root directory:




#Config Stuff...
php_flag session.use_trans_sid off

############################################
################# mod GZIP! ###################
############################################

php_value zlib.output_compression 1
php_value zlib.output_compression_level 3

############################################
#### URL Rewriting Hack (See loadpage.php for more info) #####
############################################


RewriteEngine on

######### Ban Evil Robots..... ##########
RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]
RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*NEWT [OR]
RewriteCond %{HTTP_USER_AGENT} ^Crescent [OR]
RewriteCond %{HTTP_USER_AGENT} ^CherryPicker [OR]
RewriteCond %{HTTP_USER_AGENT} ^[Ww]eb[Bb]andit [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebEMailExtrac.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^NICErsPRO [OR]
RewriteCond %{HTTP_USER_AGENT} ^Teleport [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus.*Webster [OR]
RewriteCond %{HTTP_USER_AGENT} ^Microsoft.URL [OR]
RewriteCond %{HTTP_USER_AGENT} ^LinkWalker [OR]
RewriteCond %{HTTP_USER_AGENT} ^DIIbot [OR]
RewriteCond %{HTTP_USER_AGENT} ^psbot [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailCollector
RewriteRule ^.* - [F]
######### Evil robots banned! ##########

######### Rewrite legitimate urls! ##########
RewriteRule ^.*\.htm loadpage.php [L]
RewriteRule ^.*\.html loadpage.php [L]
RewriteRule ^.*\.php* loadpage.php [L]
RewriteRule ^.*!\.* loadpage.php [L]
######### Legitimate urls rewritten! #########




3) The code instructs Apache to open a file called loadpage.php instead of the file which didn't exist.
4) Loagpage.php checks the enviroment variables and finds the name of the file the person was looking for, deciphers the friendly url into one it understands, fires up the templating engine and database abstraction library, includes the appropriate php file to generate the page the user wanted to see, builds the template and converts all the links in the page to friendly ones, echoes the contents of the finished page, and it's done!


This all works great with one url, but now I want my classifieds section to have a shorter url (safarri.com). I have already bought the domain name, so now what do I do?
I think the domain name dns needs to be configured to point to my server or something, and the .htaccess code may need to be modified too.

Thanks for your help!

P.S. Suggestions about my new classifieds site would be appreciated!
http://www.allthingsinteresting.com/classifieds (and hopefully soon) http://www.safarri.com

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 01-11-2005 22:24

you will indeed need to point the domain to your server. That's something you have to do on your name server - probably provided by the company you bought the domain name from.

Your rewriteRules should continue to work as before. You might have to change your loadpage.php though, sincce the ,classifieds folder won't be in your requests anymore.

so long,

->Tyberius Prime

robur
Obsessive-Compulsive (I) Inmate

From:
Insane since: Jan 2005

posted posted 01-12-2005 00:12

Sorry, but I just can't seem to understand this.

I set the name servers of safarri.com to be the same as the name servers of allthingsinteresting.com (my original website), but when I go to allthingsinteresting.com it shows me my site, and when I go to safarri.com it says the page doesn't exist.
Is there something I did different? Does the firstly confugured domain name take priority or something?

I am a moderatly talented programmer, but I've never done this before so I don't know what to expect :-)

Thanks for putting up with what must seem like dumb questions

-Robur

P.S. My host has something called "addon domains". Would this help?

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 01-12-2005 02:50

Are you getting rid of the allthingsin...etc domain? If so you can simply switch the domain names through your hosting provider.

If you want to keep both but forward the safarri.com domain to the allthingsinteresting domain you want to actually use a service like Zone Edit and set up a forwarding.

What you did just makes your host's DNS servers the main ones for safarri, you actually want to configure how that DNS resolves.



.:[ Never resist a perfect moment ]:.

hyperbole
Paranoid (IV) Inmate

From: Madison, Indiana, USA
Insane since: Aug 2000

posted posted 01-12-2005 19:29

Just ask your web hosting company to make the new domain name (safarri.com) a pointer domain (or alias) to your existing domain.

You will need to add a RewriteCond to your .htaccess file so that it will catch any requests for the classifieds and directs them to the proper script or as Tiberius said keep the .htaccess file the same and change your php script so that it recognizes when the user is asking to view the classifieds.

I tried going to safarri.com, but go the message that the domain name could not be resolved. It apparently hasn't propagated to my ISP yet. I suggest that the reason you are getting a page not found error is that your *.php script doesn't recognize the name safarri.com.

Check your server's error logs to see if you are getting errors from .htaccess. If not check the script to see if it is generating an ferro when you invoke it from safarri.com.


.

-- not necessarily stoned... just beautiful.

robur
Obsessive-Compulsive (I) Inmate

From: Careywood, Idaho, USA
Insane since: Jan 2005

posted posted 01-12-2005 21:37

Okay, I think I get it

I just set up safarri.com as something which my webhost calls a "Parked Domain" for my main domain name, allthingsinteresting.com.
That way, (as I understand it) anyone who visits safarri.com will see the same thing as if they were visiting allthingsinteresting.com. It should then be relatively easy to modify my php script to figure out the rest (showing them the contents of /classifieds instead of just the home page, etc)!

Thanks for your help!

-Robur

« BackwardsOnwards »

Show Forum Drop Down Menu