Reputation: 1215
I'm trying to set up a simple rewrite rule so that something like
mysite.com/admin
becomes
mysite.com/new/admin
I have tried the following :
RewriteEngine On
RewriteRule ^admin.* new/admin [L]
But that doesn't seem to be working. It just results in a 404 error, which is the same as what I was getting before. My logs don't seem to show anything. Here is my configuration file:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName mysite.com
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
If anyone knows the proper rewrite rule to settle this, that would be most excellent!
Upvotes: 0
Views: 560
Reputation: 7856
Try this:
RewriteEngine On
RewriteBase /
RewriteRule ^admin(.*) new/admin$1 [L,R,QSA]
Flags explanation:
L
- last rule (processing will stop at that point)R
- redirect (without this flag, apache will do sub-request and will still show the original URL to the browser)QSA
- append the original query-stringUpvotes: 2
Reputation: 1768
Can you please try the following with the slash..
RewriteRule ^admin.* /new/admin [L]
Upvotes: 0