3 domains, 3 subdirs, 1 virtual server

Using a single web hosting account to host multiple sites

3 domains, 3 subdirs, 1 virtual server

Postby insp3kt0r » Sun Jul 05, 2009 11:52 pm

I have three different domains for a restaurant web site. One part of website is in English (.com), one in Finnish (.fi) and one in Chinese (.cn). "National parts" are published on their own subdirectoriess on one single virtual server account. However I need/want to hide that subfolder on url-path.

Everything is working just fine expect when working with one feedback form. Please feel free to try the form yourself to see the problem live.

You can see the problem by trying the form with long address http://www.wokkipannu.fi/finnish/yhteystiedot.php (this is fully working, even the form processor). However using address which also should function http://www.wokkipannu.fi/yhteystiedot.php, the form resets after submitting and do not transfer to thank you -page like in first case.

Unfortunately my ISP allows this only this way - using .htaccess and mod_rewrite. If I like to have independent directions, I need to have three accounts and pay triple.

There must be some rewrite-related problem. Code from .htaccess is attached below.

Code: Select all
RewriteEngine On

RewriteCond %{HTTP_HOST}  wokkipannu.fi$ [NC]
RewriteCond %{REQUEST_URI} !^/finnish/.*$
RewriteRule ^(.*)$  /finnish/$1 [L]

RewriteCond %{HTTP_HOST}  wokkipannu.cn$ [NC]
RewriteCond %{REQUEST_URI} !^/chinese/.*$
RewriteRule ^(.*)$  /chinese/$1 [L]

RewriteCond %{HTTP_HOST}  wokkipannu.com$ [NC]
RewriteCond %{REQUEST_URI} !^/english/.*$
RewriteRule ^(.*)$  /english/$1 [L]


Help would be highly appreciated.

Regards, Marko
insp3kt0r
 
Posts: 3
Joined: Sun Jul 05, 2009 11:15 am

Postby richardk » Mon Jul 06, 2009 12:24 pm

I think the problem is cause by the JavaScript.
Code: Select all
<form action="" method="post" name="emailContact" id="emailContact" onsubmit="">

There is no <form> action="" or onsubmit="" JavaScript handler. Somewhere it should be setting it, but it isn't.

Edit: A better mod_rewrite
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Add missing trailing slashes
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/finnish  ^(www\.)?wokkipannu\.fi(/finnish)$  [NC,OR]
RewriteCond %{HTTP_HOST}/chinese  ^(www\.)?wokkipannu\.cn(/chinese)$  [NC,OR]
RewriteCond %{HTTP_HOST}/english  ^(www\.)?wokkipannu\.com(/english)$ [NC]
RewriteCond %{DOCUMENT_ROOT}%2%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/finnish  ^(www\.)?wokkipannu\.fi(/finnish)$  [NC,OR]
RewriteCond %{HTTP_HOST}/chinese  ^(www\.)?wokkipannu\.cn(/chinese)$  [NC,OR]
RewriteCond %{HTTP_HOST}/english  ^(www\.)?wokkipannu\.com(/english)$ [NC]
RewriteRule .* %2%{REQUEST_URI} [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby insp3kt0r » Tue Jul 07, 2009 1:06 am

First, thanks for the cleaner edit for mod_rewrite. Changed it and everything ok.

Problem can't be on JavaScript. It is handled by several php-documents located on other subdirectory inside same directory where the contact form in itself is.

I guess you didn't try the two different urls for the form and try to submit.

The problem still occurs. With long address form is functioning and sending the email and redirecting sender to thank you -page. With short address no.
insp3kt0r
 
Posts: 3
Joined: Sun Jul 05, 2009 11:15 am

Postby insp3kt0r » Tue Jul 07, 2009 2:56 am

Hmmm... I even tried a different method.

I created subdir yhteystiedot and put the contact form there as index.php with necessary subdirs and files.

http://www.wokkipannu.fi/yhteystiedot/index.php

Nothing working. Something breaks up with .htaccess mod_rewrite.
insp3kt0r
 
Posts: 3
Joined: Sun Jul 05, 2009 11:15 am

Postby richardk » Tue Jul 07, 2009 9:09 am

The problem can't be solved by changing the mod_rewrite. The PHP (not the JavaScript, you are correct) is probably expecting a _SERVER variable to be set with /finish in it (or not in it) and failing because of that.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 27 guests

cron