Jump to content


htaccess rewriting my subdomain


2 replies to this topic

#1 The Creator

    Young Padawan

  • Members
  • Pip
  • 115 posts
  • Gender:Male
  • Location:England
  • Interests:Computers, Music, Technology, Sport

Posted 10 April 2008 - 11:01 AM

Hi again, im back and probably not for the last time.

I'm writing a new version in a temporary subdomain called v2.example.com...

www.example.com and v2.example.com both have their own htaccess

but i think the htaccess of www.example.com is interfering with v2

sometimes i get www.example.com when i go to v2.example.com

and i always get www.example.com when i got v2.example.com/something/


is there any htaccess code i can put in the www.example.com htaccess to stop it from doing this?!

thanks again,

The Creator

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 10 April 2008 - 04:00 PM

Technically that shouldn't be possible. .htaccess is directory based, meaning that if you have a .htaccess file in one directory, all sub-directories of that directory will be affected by it provided there isn't an alternate .htaccess file in that directory.

Make sure you don't have any <base> tags in your html, and then post your .htaccess so we can see what's up.

#3 The Creator

    Young Padawan

  • Members
  • Pip
  • 115 posts
  • Gender:Male
  • Location:England
  • Interests:Computers, Music, Technology, Sport

Posted 10 April 2008 - 04:22 PM

alright...

.htaccess of www.example.com is...



Options +FollowSymLinks 

RewriteEngine on

RewriteBase /






php_flag register_globals off
php_value session.use_only_cookies 1 
php_value session.use_trans_sid 0



RewriteRule ^forums/(.*)$ http://www.example.com/forums/$1 [L]

RewriteRule ^forums$ http://www.example.com/forums/ [L,R=301]

RewriteRule ^forums/$ http://www.example.com/forums/index.php [L]


RewriteRule ^images/avatars/(.*)/$ http://www.example.com/images/avatars/$1 [L]

RewriteRule ^webalizer/?$ http://www.example.com/webalizer/index.html [L]

RewriteRule ^search/(.*)/(.*)/(.*)/?$ http://www.example.com/index.php?p=search&c=$1&s=$2&n=$3 [L]

RewriteRule ^activate/(.*)/(.*)/?$ http://www.example.com/index.php?p=activate&u=$1&c=$2 [L] 

RewriteRule ^user/f/(.*)/(.*)/?$ http://www.example.com/index.php?p=user&m=$1&f=$2 [L]

RewriteRule ^user/(.*)/(.*)/?$ http://www.example.com/index.php?p=user&m=$1&l=$2 [L] 

RewriteRule ^user/(.*)/?$ http://www.example.com/index.php?p=user&m=$1 [L]



RewriteRule ^confirm/(.*)/?$ http://www.example.com/index.php?p=confirm&n=$1 [L]

RewriteRule ^section/view/(.*)/?$ http://www.example.com/B2AIOU23/view.php?t=$1 [L]

RewriteRule ^section/(.*)/(.+)/?$ http://www.example.com/index.php?p=section&m=$1&e=$2 [L]

RewriteRule ^news/(.*)/(.*)/?$ http://www.example.com/index.php?p=news&m=$1&l=$2 [L]

RewriteRule ^news/(.*)/?$ http://www.example.com/index.php?p=news&m=$1 [L]

RewriteRule ^H/(.*)$ http://www.example.com/tools/HX8ILO04K/$1 [L]

RewriteRule ^(.*)/$ http://www.example.com/index.php?p=$1 [L]



ErrorDocument 404 http://www.example.com/404/


That ones a bit scrappy because i wrote it ages ago with very little knowledge of .htaccess so there's probably lots of pointless stuff in it, but there it is.


Here's the htaccess of v2.example.com:

Options +FollowSymLinks 

RewriteEngine on

RewriteBase /


php_flag register_globals off

php_value session.use_only_cookies 1 

php_value session.use_trans_sid 0


RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ http://v8.example.com/index.php?L1=$1&L2=$2&L3=$3&L4=$4 [L]

RewriteRule ^(.*)/(.*)/(.*)/$ http://v8.example.com/index.php?L1=$1&L2=$2&L3=$3 [L]

RewriteRule ^(.*)/(.*)/$ http://v8.example.com/index.php?L1=$1&L2=$2[L]

RewriteRule ^(.*)/$ http://v8.example.com/index.php?L1=$1 [L]

ErrorDocument 404 http://v8.example.com/404/

there ya go :worthy:

any ideas?

The Creator





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users