1

I've just installed the sample-data on a Magento 1.9.0 and none of the links work even after turning off URL rewrites and reindexing everything.

With URL rewrites ON, no catalog links will work.

With URL rewrites OFF, only the top level catalog links work.

With off, I get top level links like mysite.com/index.php/women.html and this works fine. The child links, turn into mysite.com/women/new-arrivals and this results in 404. If I manually add the index.php it will resolve correctly as in mysite.com/index.php/women/new-arrivals.

I have already tried reindexing everything numerous times, clearing all caches, and all to no effect. How do I get the child links to resolve correctly?

1

The same problem happens to me, i solved it by enabling clean url rewrites. on ubuntu 12.04 lamp server, run these commands (found on web)

sudo a2enmod rewrite && sudo service apache2 restart

ls -l /etc/apache2/mods-available/rewrite.load    ///if it prints out rewrite.load, it's there and ready to go
sudo a2enmod rewrite   //enables the mod

ls -l /etc/apache2/mods-enabled/rewrite.load // shows created symlink

sudo vi /etc/apache2/sites-available/default   //opens the file in vi (you can also use vim or nano)

Replace occurrences of "AllowOverride None" with "AllowOverride all" as necessary

sudo service apache2 restart

Edit your virtual host entry in /etc/apache2/sites-available and add AllowOverride All to the DocumentRoot. Your virtual host should ultimately look something like this:

<VirtualHost *:80>
  ServerName example.com
  DocumentRoot /var/www/vhosts/example.com
  <Directory /var/www/vhosts/example.com>
    AllowOverride all
  </Directory>
</VirtualHost>

Although this isn't suitable for production environments, it works just fine for local development
  • What is wrong for a production environment? – o_O Jun 6 '14 at 14:35
  • i am not a server expert, it may create a security hole or something you don't want. if the answer solved your problem, please check it as solved. – Haris Jun 7 '14 at 4:20
  • for production environment you must contact your service provider to set the server for you. – Haris Jun 19 '14 at 4:10
  • what if I can't access shell & execute these commands? I'm working in shared hosting – Raptor Sep 4 '14 at 10:49
0

Create a .htaccess file and add this line.

ErrorDocument 404 /foo.html

This will redirect any 404 error to foo.html

0

Same problem for me on Centos 6.5

solved by

1, allowing .httaccess files to override stuff on your server

by editing thee file /etc/httpd/conf/httpd.conf on server

in that file make sure this path is correct

# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">

and set the AllowOverride below in that section to All

AllowOverride All

2,copy from the .httaccess.sample file from the magento download

<IfModule mod_rewrite.c>

############################################
## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

    #RewriteBase /magento/

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>

and add it to the .htaccess file in the top directory of your magento istallation (if it is not there then create one)

3, make sure rewrites are turned on in your admin->system->configuration->web->search engines optimization

done

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.