logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: RewriteRule to redirect subdirectory
Author
ale



Joined: 20 Apr 2016
Posts: 2

PostPosted: Wed 20 Apr '16 21:32    Post subject: RewriteRule to redirect subdirectory Reply with quote

Hello all, i'm a newbie and i'm on win8 with apache 2.4
inside phpBB .htaccess i've put this code to redirect to another directory:
phpBB is at http://localhost/root/phpbb3_test
while mysite is at http://localhost/mysite/

if i try http://localhost/root/phpbb3_test/index.php with the follow in .htaccess:
Code:
RewriteBase /HTDOCS/mysite/
RewriteRule    ^index.php?$   /mysite/index.php/forum/?mode=sendpassword [PT]
correctly redirect me to http://localhost/mysite/index.php/forum/?mode=sendpassword
while if i try http://localhost/root/phpbb3_test/ucp.php?mode=login with this
Quote:
RewriteBase /HTDOCS/mysite/
RewriteRule ^ucp.php?mode=login?$ /mysite/index.php/forum/?mode=login [PT]

do not correctly redirect me to http://localhost/mysite/index.php/forum/?mode=login

i think that should be a problem in the part
Code:
RewriteRule  ^ucp.php?mode=login?$
, but i've search and try many solutions without success, so i've not understand something. Thank you
Back to top
ale



Joined: 20 Apr 2016
Posts: 2

PostPosted: Thu 21 Apr '16 18:37    Post subject: so i've try Reply with quote

this code instead
Code:
RewriteRule "^ucp\.php?(.*)" "/mysite/index.php/forum/?$1" [PT]

with http://localhost/root/phpbb3_test/ucp.php?mode=login
return phpBB index.php Mr. Green what shame ... Embarassed
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Sun 24 Apr '16 17:32    Post subject: Reply with quote

The RewriteBase is not set correctly. There shouldn't be a htdocs inside. Only the path from the url, not the file system path.

Catching a Query is easy in 2.4

[/cide]
<LocationMatch ^/ucp.php>
<If "%{QUERY_STRING} =~ /mode=login/">
# do something if query string is mode=login
</If>
</LocationMatch>
[/code]
Back to top


Reply to topic   Topic: RewriteRule to redirect subdirectory View previous topic :: View next topic
Post new topic   Forum Index -> Apache