mod_rewrite

Status
Not open for further replies.
(See updates at the bottom)

I installed Apache in Ubuntu 13.10 and tried to make a site.

Here's the config for Apache:

Code:
<IfModule alias_module>
    Alias /MicrowaveHomepage /media/sf_F_DRIVE/NetBeansProjects/MicrowaveHomepage/public_html
</IfModule>

<Directory "/media/sf_F_DRIVE/NetBeansProjects/MicrowaveHomepage/public_html">
    Options FollowSymLinks
    DirectoryIndex index.php

    Options None
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

And then, in the folder above public_html, I have .htaccess:

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

Basically, copied from Wordpress.

Now, my understanding is that if I go to http://localhost/MicrowaveHomepage/index1.php, I should be presented with http://localhost/MicrowaveHomepage/index.php instead. Well, that's not what happens. I just get a 404.

?

Also, PHP says that mod_rewrite is loaded. Jewelry, women, mini-giraffes, the works.

UPDATE: Changed the main Apache config: for folder "/", set AllowOverride to All. That gets the htaccess to be read (putting garmage in it causes it to crash). It doesn't lead to success, though.

UPDATE: Realized it IS working, it's just redirecting incorrectly. While tweaking, at some point I changed the rewrite rule to go to index.php instead of /index.php. But either is wrong, because it's /MicrowaveHomepage/index.php.

Now .htaccess says:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /MicrowaveHomepage/index.php?_REQUEST=$1 [L,QSA]
</IfModule>
 
Status
Not open for further replies.