My magento is installed on Ubuntu Linux under /var/www/magento . This question looks like some of the questions in the archives but is acutally somewhat different. When I installed Magento on Ubuntu Linux I enabled Apache mod_rewrite URL rewrites.
When I go to http:// localhost/magento my server rewrites the URL as http:// localhost/magento/ and displays the page. I then click on one of the links in the navigation bar, let's say it's nav-bar item "foo". Then magento takes me to:
http:// localhost/magento/foo.html
which displays a "Not Found" apache page.
I have to change the URL to ----->
http:// localhost/magento/index.php/foo.html
in order to display the page.
It is as though something is amiss in my mod_rewrite workings.
Thanks,
John Goche
CONFIGURATION: System -> Configuration -> (General ->) Web:
Use Web Server Rewrites: YES
Base URL: http:// localhost/magento
If I set "User Web Server Rewrites:" to NO, then the links from my main page work fine, but see the page http:// localhost/magento/index.php/foo.html which displays the correct page, but whereas the website works I don't like the URL. I would like it to be http:// localhost/magento/foo.html without the index.php bit, as this would also probably be more SEO-friendly.
THanks,
John Goche
Update: I've tried uncommenting my artificial 127.0.1.1 IP address which ubuntu had put in /etc/hosts and placing ther my real IP but no luck. I still have exactly the same problem. And the URL inside my browser is rewritten to http:// localhost / etc... whenver I type 192.168.3.31, avalanche, or avalanche.com inside it. I am still trying to figure out how to solve the problem described above as this did not do it.
127.0.0.1 localhost
#127.0.1.1 avalanche
192.168.4.35 avalanche avalanche.com
When I restart Apache I get:
# service apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.4.35 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.4.35 for ServerName
Not sure how to fix the original issue. I am testing on a local server.
I've even tried this solution and then restarted apache2, but no luck!
How to remove index.php from URLs?
so placing:
RewriteEngine On
RewriteBase /mymagento/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
does not work, even with RewriteBase /, it does not work.
OK, finally I managed to solve the probkem. The file /etc/apache2/sites-enabled/000-default has the following directive set for all directories defined within this file:
AllowOverride None
For instance, for /var/www which is the default document root set on Ubuntu 12.04 LTS Linux system this file contains
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
which as far as I understand means that .htaccess files found in this directory and all of its subdirectories will not be parsed. To fix the problem it is sufficient to set:
AllowOverride All
meaning you will be able to override the server configuration directives found in /etc/apache2/apache2.conf (or /etc/apache2/httpd.conf which is included therein).
One of the reasons AllowOverride is set to None by default could be that it slows down the server and the other is for security reasons. This directive should be set inside a tag and the latter ones can override the former. Another reason this is not set by default is that having to parse .htaccess recursively across the site each time a file in a directory path is loaded can slow down the system and thus placing the .htaccess stuff in /etc/apache2/httpd.conf when possible is recommendable as it can cause an increase in speed.
So place
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
#AllowOverride None
AllowOverride All
Order allow,deny
allow from all
</Directory>
inside /etc/apache2/sites-enabled/000-default
and run: service apache2 restart
is the solution.
I had the same problem when transferring my live site into localhost. Finally i resolved it.
I have windows OS. So i used WAMP stack for my localhost. I have spent lot of time to retrieve all the URL and its content in my localhost by changing .htaccess file,modifying core_config_data table in DB but everything went wrong.
Finally i got a clue to enable rewrite_module in Apache server. 1. To enable it Click on the Wamp icon in the tray bar (WAMP->Apache->Apache modules-> and select rewrite_module). 2. Restart Wamp Server. 3. clear cache (optional i think) - Delete all the files in the var/cache folder
Make Sure you have .htaccess file in your root folder lets assume(localhost/magento/.htaccess). If you don't have you will not get the result.
Thats it.
I hope now u will able to retrieve all other pages and URL other than home and also u will not get 404 error page.
Did you try:
and not RewriteBase /mymagento/ because your url is http:// localhost/magento/
Does your apache virtual host allow to overwrite the config, e.g.
Within the Magento configuration (accessed in the Magento Admin Panel through System > Configuration) there are some relevant settings that determine what the eventual Search Engine Friendly URL looks like.
A setting which should always be turned on. If not "/index.php/" will be added to URL which is unnecessary and looks ugly. To enable this option, you also need Apache mod_rewrite enabled in your hosting environment.
The default value here is ".html" which will be appended to each product URL. Some SEO-experts claim this is needed for better rating, other SEO-exports say it is not. For our MageBridge integration with Joomla! this setting needs to be empty.
The same as above, but now categories.
With this option enabled, the product URL will also include the category URL Keys. While it could be argued this causes duplicate content, product pages might also benefit from this because they become part of a bigger structure.
If you are really worried about duplicate content (which is not as bad as some people will tell you), then you can enable the canonical tag which tells search engines which page is leading once duplicate content has been detected.
The same as above, but for categories.
further reading on the matter http://www.yireo.com/tutorials/magento/magento-administration/664-fixing-url-rewrites-with-magento
Do you have the appropriate .htaccess file in your Magento root? Also, you may run into issues with
localhost
. It's advised to use 127.0.0.1 or to map dev domains in your hosts file.It is a mod_rewrite issue. I'm running Ubuntu and had the same problem during setup of apache and magento for a store migration.
Change
/etc/apache2/sites-available/000-default.conf
to containthus allowing rewrites for
var/www
on the webserver.To make apache process the rewrite rules from magentos .
htaccess
file(s),enabling the rewrite module via
and restarting apache via
solved the entire issue for me.
See http://wiki.ubuntuusers.de/Apache/mod_rewrite and
http://wiki.ubuntuusers.de/Apache for a thorough explanation of how to set things up the right way.