We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Moved site: 404 when clicking any links past Index page | Forum

Scott
Scott Aug 13 '14
Hello,

I have moved my site from a shared host to a VPS. I get 404 errors every time I click a link on the Index page, making the site inoperable. I fear this may be an htaccess issue, in which case I need to a) make sure .htaccess, and b) ensure other configurations are in place.

~$ ls /etc/apache2/mods-enabled/
Results include rewrite.load, showing mod_rewrite is enabled.

My Apache2 conf for the site:
~$ cat /etc/apache2/sites-enabled/site.us.conf
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName site.us
    ServerAlias www.site.us
    DocumentRoot /var/www/site.us/public_html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/site.us/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>


My .htaccess:
~$ cat /var/www/site.us/public_html/.htaccess
ErrorDocument 404 /404.html
Options +FollowSymLinks

RewriteEngine On



AddEncoding gzip .gz

AddEncoding gzip .gzip

<FilesMatch "\.(js.gz|js.gzip)$">

  ForceType text/javascript

</FilesMatch>

<FilesMatch "\.(css.gz|css.gzip)$">

  ForceType text/css

</FilesMatch>





RewriteCond %{REQUEST_URI} !^/index\.php

RewriteCond %{REQUEST_URI} !/ow_updates/index\.php

RewriteCond %{REQUEST_URI} !/ow_updates/

RewriteCond %{REQUEST_URI} !/ow_cron/run\.php

RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]

RewriteRule (.*) index.php

order allow,deny
deny from 122.162.
deny from 113.193.27.
deny from  59.180.
allow from all

Any help is appreciated.
ross Team
ross Aug 14 '14
Scott, can you please replace your .htaccess file with the original one? what will you see then, if you try the same links?
ross Team
ross Aug 14 '14
Scott
Scott Dec 14 '14
Just a follow up. I'm running this on a vps running Ubuntu/LAMP with as standard configuration. The problem is Apache wasn't adhering to the configuration from the .htaccess in the public_html root. It was supposed to, I thought... I ended up needing to put the .htaccess information into /etc/apache2/sites-available/mySite.conf.

I have had such an impossible time as a newbie to understand how to actually use the site conf files. Hopefully someone can use this; God knows I could have about 12 hours ago. Here's mine:

<VirtualHost *:80>
        ServerName site.us
        ServerAlias www.site.us

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/site/public_html

        <Directory /var/www/sitee/public_html>
        Options +FollowSymLinks
        RewriteEngine On
        AddEncoding gzip .gz
        AddEncoding gzip .gzip
        <FilesMatch "\.(js.gz|js.gzip)$">
                ForceType text/javascript
        </FilesMatch>
        <FilesMatch "\.(css.gz|css.gzip)$">
                 ForceType text/css
        </FilesMatch>
        RewriteCond %{REQUEST_URI} !^/index\.php
        RewriteCond %{REQUEST_URI} !/ow_updates/index\.php
        RewriteCond %{REQUEST_URI} !/ow_updates/
        RewriteCond %{REQUEST_URI} !/ow_cron/run\.php
        RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]
        RewriteRule (.*) index.php
        #block ip
        #order allow,deny
        #add IP
        #allow from all

        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


ross Team
ross Dec 15 '14
Scott, so this htaccess solves the issue with 404 errors?

If yes, then your server is misconfigured. Anyway, hope this will be helpful for other community members.