TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-30-2009, 06:31 PM   #1 (permalink)
The Wanderer
 
Germanium's Avatar
 
Join Date: Nov 2007
Posts: 9
Thanks: 0
Germanium is on a distinguished road
Unhappy Htaccess or PHP?

Ok I have a site that I'm trying to build up and basically it's been running off the temporary url that my host offers for when the dns resolves it's built some traffic on that url.

What I want to do is make it so that people can still acess urls on that site, but if google comes around it shows a 301 redirect. Right now I'm doing this with a 301 redirect with htaccess so that all urls are sent to the domain.

What I'd like is to have htaccess do a 301 for all urls except the main page, so that if user enters http://subdomain.host.com it shows them the site but when google comes to the page it tells them 301 to the actual domain. All other urls on that subdomain should 301 to the domain.

So basically I need either an htaccess or php way of making it so that just the main page is accessible on the subdomain, and that all other urls are directed through the domain.

Current Htaccess:
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)sub.host.com [NC]
RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L]

ErrorDocument 404 /404.php
ErrorDocument 500 /404.php
ErrorDocument 502 /404.php
I was thinking htaccess could be used to allow 1 url to be accessible on the subdomain and all others 301 to the domain. Then I would write some php on the main file to detect the url entered and if subdomain and google - 301 to the main domain with headers.


Need some help +rep for good advice
Send a message via ICQ to Germanium Send a message via MSN to Germanium Send a message via Yahoo to Germanium
Germanium is offline  
Reply With Quote
Old 07-31-2009, 09:57 PM   #2 (permalink)
The Wanderer
 
Germanium's Avatar
 
Join Date: Nov 2007
Posts: 9
Thanks: 0
Germanium is on a distinguished road
Default

can anyone help?
Send a message via ICQ to Germanium Send a message via MSN to Germanium Send a message via Yahoo to Germanium
Germanium is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't get PHP 5. to work? Newbie windows PHP guy DotNetTim Absolute Beginners 11 02-01-2013 11:02 AM
How to protect your php files & database if PHP fails! Sam Granger Tips & Tricks 5 02-18-2012 08:07 PM
10 PHP Myths Dispelled Wildhoney General 9 06-15-2009 06:55 AM
PHP Compressor Kalle Script Giveaway 8 05-28-2008 12:14 AM
what are all the subjects in php? sarmenhb General 7 01-21-2008 05:41 PM


All times are GMT. The time now is 07:32 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design