Welcome to WebmasterWorld Guest from 54.144.206.214

Forum Moderators: Ocean10000 & incrediBILL & phranque

Code blocked

htaccess on subdomain is blocked by main domain.

   
1:58 pm on Jan 13, 2010 (gmt 0)

5+ Year Member



Hi everyone.

I have two scripts installed with a .htaccess file each, one script on the main domain , the other in a folder.
www.site.com
www.site.com/blog
Tha htaccess file from the main domain is blocking the htaccess file from subdomain . I got the ideea from someone that i should add new lines in the htaccess from the main domain:
RewriteEngine on

Options +FollowSymlinks

RewriteCond %{REQUEST_FILENAME} !-f

++
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ navigation.php

++
RewriteRule .* - [E=HTTP_X_REQUESTED_WITH:%{HTTP:X-Requested-With}]

Where ++ is i should add some extra code .
Please help me on what that code should be .

5:32 pm on Jan 13, 2010 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Exclude the blog subdirectory from the top-level .htaccess file rewrite rule:

RewriteCond $1 !blog/

You should also exclude "navigation.php" itself from that rule. Doing so will approximately double the speed of that rule, which is very slow since it has to go check the filesystem four times as it is now:

RewriteCond $1 !navigation\.php$

Move the "[E=" rule to the top, and then add an [L] flag to all the following rules.

Jim

7:08 pm on Jan 13, 2010 (gmt 0)

5+ Year Member



Hi Jim .

The way it looks after i did the changes :

RewriteEngine on
Options +FollowSymlinks

RewriteRule .* - [E=HTTP_X_REQUESTED_WITH:%{HTTP:X-Requested-With}]
RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond $1 !blog/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !navigation\.php$

If i put [L] to the last 4 rules at the end it will give me a """Error 500:Internal Server Error """
The way it is now it's kind of the same as before . I must not be following your instructions as i should.
Please tell me what can i change .
Thank you Jim.

Mircea.

7:36 pm on Jan 13, 2010 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



> If i put [L] on the last 4 rules at the end it gives me a "500-Internal Server Error"

There are only two rules in this file. The code should now look like this:


Options +FollowSymlinks
RewriteEngine on
#
# Copy HTTP "X-Requested-With" header to similarly-named server variable
RewriteRule .* - [E=HTTP_X_REQUESTED_WITH:%{HTTP:X-Requested-With}]
#
# Rewrite all requests for URL-paths which do not resolve to existing files or directories to
# "/navigation.php", except for /blog requests and internal requests for "/navigation.php" itself
RewriteCond $1 !^navigation\.php$
RewriteCond $1 !^blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ navigation.php [L]

Jim
8:10 pm on Jan 13, 2010 (gmt 0)

5+ Year Member



It will still take me to a PAGE NOT FOUND
I did copy and paste of all the stuff above maybe it's because of something else.
Thanks so much JIM.
You think it's a different problem ?
8:15 pm on Jan 13, 2010 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Did you clear/delete the browser cache before testing again?

What does "Live HTTP Headers" return for the test URL?

8:29 pm on Jan 13, 2010 (gmt 0)

5+ Year Member



I did the refresh and i get :
blog/not_found.html
I am checking out some other post here and testing , no results though.
8:32 pm on Jan 13, 2010 (gmt 0)

5+ Year Member



I'm sorry was i supposed to leave this part as it is or change something ?
# Copy HTTP "X-Requested-With" header to similarly-named server variable
RewriteRule .* - [E=HTTP_X_REQUESTED_WITH:%{HTTP:X-Requested-With}]
#
8:57 pm on Jan 13, 2010 (gmt 0)

5+ Year Member



I found this one , for others worked ...
It seems different from the way my rules are.

<rewrite url=".*/blog/(.+)" to="$1" processing="stop" />

9:37 pm on Jan 13, 2010 (gmt 0)

5+ Year Member



Ok.
So i got what you wrote above in domain .htaccess and added # RewriteBase /
And in the other subdomain i added: RewriteBase /blog/
And that was it.
Thanks soo much for your time Jim.
Cheers.
Mircea
 

Featured Threads

Hot Threads This Week

Hot Threads This Month