0

I took my Magento store from a live site to a localhost. Magento's version is 1.7, and it's running over WAMP on my localhost. The homepage was working fine, but all URLs from there gave 404 error from the server. However, if I included index.php manually in each URL, everything worked fine. I figured out that going to Admin/System/Configuration/General/Web, I had enabled the option for URL rewrites that removes index.php. When I disable this option, my site works properly. So, I searched about this problem, and tried different things, but I have not been able to solve it.

I have mod_rewrite enabled, that's the first thing I checked.

I have seen lots of posts recommending to overwrite either an .htaccess file or a httpd.conf (Apache's configuration file) file.

My .htaccess looks like this right now:

<IfModule mod_rewrite.c>

Options +FollowSymLinks
RewriteEngine on

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule .* ../get.php [L]
</IfModule>
  • I also checked that in httpd.conf I had AllowOverride al, and indeed, among other things, I have the following:

    code:

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride all
    

My site is still not working when enabling the option for removing index.php from all URLs.

Does anyone have an idea of what I might be missing? Any help will be much appreciated :-)

  • have you enable server rewrites from admin panel? – Teja Bhagavan Kollepara Nov 16 '16 at 16:05
  • I have enabled server rewrites yes – Xavier Nov 17 '16 at 9:06
  • 1
    ok, please goto root folder once and check .htaccess file is there or not. or better to download fresh .htaccess file and import to root – Teja Bhagavan Kollepara Nov 17 '16 at 9:12
  • Thanks for answering. My .htaccess file is not in my root folder. Instead, it's in the /media folder. I'm editing my original post to include my code in my .htaccess file, could you please tell me if I'm missing something? – Xavier Nov 17 '16 at 9:21
  • so, working fine now right? – Teja Bhagavan Kollepara Nov 17 '16 at 9:29
0

I'm not sure the conversion is that different from apache2 to httpd (I'm assuming you're on centos) but try this:

<Directory /var/www/html>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all

  • Thanks for answering; in which file should I add this code? I am on Windows 10 using WAMP. I don't have such /var/www folder. I have /var inside my Magento folder and www inside my WAMP folder. – Xavier Nov 17 '16 at 9:01
  • You'll need to open up the vhost files available via clicking the wamp logo in system tray then hover over apache then click httpd-vhosts.conf and you'll find the vhost then, my original answer didn't include the end bit for some reason so make sure you add </Directory> to the end of the bit I've suggested putting in. – Timothy Frew Nov 17 '16 at 10:24
  • Thank you. I just added the code you provided but still not working. I cleared Magento's and browser's cache, and reindexed everything from Admin panel before trying. – Xavier Nov 17 '16 at 11:28
  • If you click wamp then hover over apache then hover over extensions and make sure rewrite is ticked – Timothy Frew Nov 17 '16 at 13:27
  • Indeed I have rewrite_module ticked, yes. – Xavier Nov 18 '16 at 9:07

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.