0

server: ubuntu 10.4 running apache2

I have a server with mod_rewrite and it works on my virtual hosts. But I am developing a new site and want to see it on the server before I change the name servers to point to the server. So in the default site config I added

Alias /tester/ "/srv/www/tester.org/wwwroot/"
<Directory "/srv/www/tester.org/wwwroot/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    allow from all
    DirectoryIndex  index.php index.html index.shtml
</Directory>

I can see the site when I go to serverIP/tester/ but with the following .htaccess file I am only getting "page not found" errors for anything but index.php.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /tester/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /tester/index.php [L]
</IfModule>
# END WordPress

I have spent about 2 hours on this but I can't even guess what I am doing wrong here. It seems like this should work. Does anything stand out to anyone?

8
  • can you describe what you are trying to do in more detail?
    – Tom
    May 29 '12 at 20:56
  • is that .htaccess file in /tester or /?
    – Tom
    May 29 '12 at 20:59
  • .htaccess file is in /srv/www/tester.org/wwwroot/
    – zortacon
    May 29 '12 at 21:46
  • I want mod_rewrite to work at server-ip-address/tester/ the same way it works if I had tester.org dns pointing to the server.
    – zortacon
    May 29 '12 at 21:47
  • is this an existing VirtualHost configuration for some other website?
    – Tom
    May 29 '12 at 21:50
0

You've set:

RewriteBase /tester/

But then you're rewriting to the same path:

RewriteRule . /tester/index.php [L]

So, you're rewriting requests to /tester//tester/index.php.

Instead of that, try this:

RewriteRule . index.php [L]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.