Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Manipulate Htaccess Directoryindex For Parked Domains


3 replies to this topic

#1 BuffaloHelp

    Sterling Archer

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 4,088 posts
  • Gender:Male
  • myCENT:50.18

Posted 17 December 2009 - 04:05 AM

The question is: can it be done?

I would like to park multiple domains to one hosting. So I can use one total web design and multiple domains to tie them all together.

However, I would like one of domains to have its own DirectoryIndex to be page a.html. Basically, all other domains will go to index.html but when Domain X is used, I want it to go to home.html.

In htaccess, DirectoryIndex home.html will do the result. But this will do for all parked domains.

I was wondering if it can be done with php or any code to achieve this, like RewriteRule or RewriteCond?

Thanks.

PS, I realize that add-on domains will be the simpler way to solve this problem. But that would mean I would have to upload one website design (about 95 files with 200 images) to each of add-on "folder." And that too would be fine except pages are changed and modified almost daily. So uploading 295 files X 6 domains can get very irritating...

==========================

Update

==========================

Not long after I posted this topic, I did little more searching, cussing and pulling my, what's left of, remaining hair and I think I have found a simpler solution.

Manipulating .htaccess RewriteEngine to direct all incoming HTTP_HOST that matches my domain "X" to redirect to "page.html" so that

RewriteEngine On
RewriteCond %{HTTP_HOST} !^http://domain"x".com$ [NC]
RewriteCond %{HTTP_HOST} !^http://www.domain"x".com$ [NC]
RewriteRule ^index\.html$ /file_default_for_this_domain.php [L]

I am not the best in writing .htaccess rewrites, but please help me if I need to clean up my code. But basically, I have domain"x" or www.domain"x" coming in, for this domain only "file_default_for_this_domain.php" will be the default home page.

If you have index.php as your default page, edit to this rule

RewriteRule ^index\.php$ /file_default_for_this_domain.php [L]

==========================

Update

==========================

Scratch the whole posting from the last update. It does NOT work! Help me... :P

#2 BCD

    Premium Member

  • Kontributors
  • PipPipPipPipPipPipPipPip
  • 168 posts
  • Gender:Male
  • myCENT:27.66

Posted 17 December 2009 - 06:31 AM

Wouldn't google apply penalty for duplicate content? Because if something exactly similar exists in two places google wouldn't like it, even in the same url, so isn't it harsh for seo? If it were to point to a single website, we could have used redirects to the main website. But the problem is the site will redirect even the page urls from one domain to just the domain of the other, and not with same url path. I think I didn't understand something there.

#3 BuffaloHelp

    Sterling Archer

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 4,088 posts
  • Gender:Male
  • myCENT:50.18

Posted 17 December 2009 - 09:21 PM

Ah ha! Maybe that's why I couldn't find an example on the web. The fear of Google's search rank has led to underdeveloped dynamic htaccess page handling.

Yes, it will hurt my SEO. And yes it will probably be frowned by google. I guess I'm not worried about that for now. And google is not the only search engine.

In a way, I'm more curious if this can be done. And while I'm perfecting a website for google's sole pleasure, I doubt that my page #20 will be cached by google's search engine. So I'm betting on the hope that my page #20 isn't relative on domain "W", it will matter for domain "X." And so, I'm making page #20 as my index page for my domain "X."

#4 BuffaloHelp

    Sterling Archer

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 4,088 posts
  • Gender:Male
  • myCENT:50.18

Posted 20 December 2009 - 03:34 AM

Okay, I finally managed to work it out.

Options +FollowSymLinks 
RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.domain"x"\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^domain"x"\.com [NC]
RewriteRule ^$ /file_default_for_this_domain.php [L]

I can't believe I almost had it on my first post... and when it didn't work, I scraped the whole thing and started to write some crazy rewrites!!!! And all this time, all I had to do was drop index\.php from the rewriterule.

This htaccess will execute different file name as its domain "default" index page. This serves my purpose.




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users