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: rewrite issues
Author
bullet2916



Joined: 04 Dec 2016
Posts: 1
Location: US, Mobile

PostPosted: Mon 05 Dec '16 0:05    Post subject: rewrite issues Reply with quote

I am trying to redirect accesses to a virtual host (main directory /) to another site, but I want requests for per user directories to remain on my server. In the <VirtualHost> directive I include

RewriteEngine On

RewriteRule /~user/ - [L]

RewriteRule ^.*$ newsite [R=301,L]

When I try the request http://currentsite/~user/index.html, it serves from my server and http://currentsite redirects. However, http://currentsite/~user also redirects. How can I get the write to send requests to currentsite? Thanks.
Back to top
James Blond
Moderator


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

PostPosted: Sat 10 Dec '16 13:16    Post subject: Reply with quote

Remove that last / from your first rewrite rule. Otherwise http://currentsite/~user will not match the rule.

I would change it to
Code:

RewriteRule ^/~user - [L]
Back to top


Reply to topic   Topic: rewrite issues View previous topic :: View next topic
Post new topic   Forum Index -> Apache