Search code examples
.htaccesshttp-status-code-404joomla2.5joomla-sef-urls

404 not found after activating Joomla 2.5 URL rewriting at localhost


I have a copy of my website at localhost at:

/var/www/vhosts/mysite.com/httpdocs

This is my /etc/apache2/sites-available/mysite

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/vhosts/mysite.com/httpdocs
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

I've copied htaccess.txt to .htaccess. When I activate friendly URL and URL rewriting, I get 404 errors.

I've uncommented this lines in .htaccess, but still does not work:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

I also tried to change rewritebase to

RewriteBase /mysite

with no luck.

What I'm doing wrong?


Solution

  • Solved! I had a conflict with different entries in /etc/apache2/sites-available. When I create a new site at localhost, I copy default to mysite, and modify the mysite file to point to it's DocumentRoot. I don't know exactly why, but if I disable default site:

    sudo a2dissite default
    

    it works.

    Maybe this does'nt solve the question, but I prefer to issue another question more specific to this problem, because I've tested and it's related to different sites enabled and one or more with RewriteEngine enabled.