Forum Moderators: phranque

Message Too Old, No Replies

rewrite subdomain->directory

mod_rewrite problems, request_uri

         

johnnyfilipov

7:54 pm on Aug 19, 2007 (gmt 0)

10+ Year Member



Hello guys,
i have problem with rewriting my directories.

www.domain.net
here is my .htaccess file

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^bv.domain.net$
RewriteCond %{REQUEST_URI} ^/$
RewriteRule .* /mydir/bv [L]

in /mydir/ i have one more .htaccess

<Files bv>
ForceType application/x-httpd-php
</Files>

so bv looks like directory.

the problem is that my script runs fine when i type domain.net/mydir/bv but when i try to rewrite i got WHITE page.

i think the problem is with request_uri, because my script use request_uri for showing pages. After rewriting the request_uri it's changed.

tnx

jdMorgan

11:36 pm on Aug 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about rewriting to the subdir and script, but passing the original Req_URI as a query string for the script to extract?

RewriteEngine on
RewriteCond %{HTTP_HOST} ^bv\.example\.net
RewriteCond %{REQUEST_URI}!^mydir/bv
RewriteRule (.*) /mydir/bv?requested_uri=$1 [L]

(Other changes made to prevent looping and clean up minor problems.)

Jim

johnnyfilipov

8:17 am on Aug 20, 2007 (gmt 0)

10+ Year Member



I try to save req_uri in $_GET and it works, but a little part of my script doesn't works, in the part when script using $_GET vars, in the other single files, everything look and works fine?
i'm using your rewrite code, i tested request_uri, and if i try to reach `somefile.php?f=21` req_uri is `somefile.php`, i think this is the problem.

tnx JD.

YEAH i've made it works with your help JD :)!
I got just one more problem, i have admin directory, and i have to rewrite it.

jdMorgan

1:36 pm on Aug 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll need to use the [QSA] flag, then, to append "uri=xyz" to any previously-existing query parameters, instead of replacing them:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^bv\.example\.net
RewriteCond %{REQUEST_URI} !^mydir/bv
RewriteRule (.*) /mydir/bv?requested_uri=$1 [[b]QSA,[/b]L]

That will result in a request for somefile.php?f=21 being rewritten to /mydir/bv?requested_uri=somefile.php&f=21

I'm sorry, but I do not understand your question about the admin directory. Please provide more information.

Jim

johnnyfilipov

1:56 pm on Aug 20, 2007 (gmt 0)

10+ Year Member



I'm rewriting phpBB forums, everything works, but when i try to reach /admin panel -> white page.

tnx

johnnyfilipov

4:31 pm on Aug 20, 2007 (gmt 0)

10+ Year Member



I think i know there is the problem.
not rewrited
url=/asd/admin/index.php?sid=d20015f8bc855bb86168365d7b8b352f
req_uri = index.php?sid=d20015f8bc855bb86168365d7b8b352f

rewrited

url=asd.domain.net/admin/index.php?sid=f23c01fae75e4442f646c09fbf95149f
req_uri = index.php

again problem with request_uri, but this time with admin folder.