• I’ve set up Apache, PHP and MySQL on my own computer, so that I can test sites locally without worrying about messing up a working configuration. Everything went smoothly except for using the mod_rewrite rules.
    I’m using a VirtualHost setup, so that I can enter http://test.artfall.co.uk/ in a browser and have it point to the files in ~/Sites/artfall. In itself, this works fine, but if I try to access any of the pages via the re-written URLs (eg. test.artfall.co.uk/archives/2004/04/24) I get a 404 error. When I look in the Apache error logs, it seems to be looking for ~/Sites/artfall/archives…etc., and obviously it doesn’t find it.
    I’ve tried using the standard .htaccess file (exactly the same as the one I have on the live–and working–site) in ~/Sites/artfall, and I’ve also tried putting the Rewrite rules instead in the VirtualHosts directive. Neither works. Has anybody got this working? I have checked that mod_rewrite is installed.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Try putting
    Options +FollowSymLinks on the first line of your .htaccess.

    Thread Starter geekgrrl

    (@geekgrrl)

    I’ve just tried that, but I get the same error.

    looks like you have to configure your virtualhost setup properly.
    googling might be the answer.

    Thread Starter geekgrrl

    (@geekgrrl)

    Thanks to both of you for your suggestions. I tried disabling virtual hosts completely, so that I access my site with http://localhost/~me/artfall. The re-writing still didn’t work. In fact now, whatever page I ask for, I get a 403 saying I’m not permitted to access index.php. (I made sure that I altered the blog URI appropriately in Options before I tried this). I’ve now turned off URI rewriting in Options and removed the .htaccess to verify that the query strings work to access other pages. They do.
    Any more suggestions? nsxpower, do you have any more tips? I don’t strictly need the vitual hosts, so if you have a working config without them, I’d be grateful for any pointers. Thanks again.

    for the 403, the suggestion I made earlier about the options +followsymlinks works just great. remember to put that line I mentioned in a previous post in the very first line of .htaccess.

    Thread Starter geekgrrl

    (@geekgrrl)

    Sorry, forgot to say that I’m using:
    Apache/2.0.48 (Unix) DAV/2 PHP/4.3.4 Server at localhost Port 80

    If you’re on a nightly build you may want to try the file option for nice permalinks, so you would put something like the following in your permalink structure:
    /index.php/archives/%year%…etc

    Thread Starter geekgrrl

    (@geekgrrl)

    WooHoo! allusion, that did the trick! I am on a nightly, but have the permalink structure rooted in /archives/%year% etc in the live version and that works fine. Does it make a difference using it on localhost, or is it an Apache 1.x/2.x difference (the live site is on 1.3)?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘mod_rewrite and virtual hosts’ is closed to new replies.