Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 3
How do I remove “index.php” in url? 
 
zhlmmc
Member
 
Total Posts:  60
Joined:  2008-07-14
 

I find “index.php” is useless in URL. For example:
http://www.example.com/index.php/test.html
is same as
http://www.example.com/test.html

How do I remove it? Thanks!

Hailong

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sindre|ProperHost
Mentor
 
Avatar
Total Posts:  1158
Joined:  2008-04-24
 

Check your Base URL in the Admin Panel, go to System | Configuration | Web and make sure the Secure and Unsecure Base URL does not include the ‘index.php’ part.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zhlmmc
Member
 
Total Posts:  60
Joined:  2008-07-14
 

Hi Sindre,

Thanks for your reply. I check my configurations, there is no “index.php”.

Hailong

 
Magento Community Magento Community
Magento Community
Magento Community
 
triality
Jr. Member
 
Total Posts:  19
Joined:  2008-10-28
 

I am having the same issues.  I do not have index.php in my secure or unsecure web configurations either.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sindre|ProperHost
Mentor
 
Avatar
Total Posts:  1158
Joined:  2008-04-24
 

Is the problem only in the admin pages, or the front end as well? Do you have url rewrites enabled?

 
Magento Community Magento Community
Magento Community
Magento Community
 
zhlmmc
Member
 
Total Posts:  60
Joined:  2008-07-14
 

This problem is in both front and backend. I don’t have url rewrites enabled.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sindre|ProperHost
Mentor
 
Avatar
Total Posts:  1158
Joined:  2008-04-24
 

That might be the problem. Try to enable url rewrites and see if that solves it. You need mod_rewrite enabled on your server.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zhlmmc
Member
 
Total Posts:  60
Joined:  2008-07-14
 

That solve the problem. After enable url rewrite, “index.php” is gone in front end. Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sindre|ProperHost
Mentor
 
Avatar
Total Posts:  1158
Joined:  2008-04-24
 

No problem! Glad I could be of assistance smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

I have the exact same issue on how to remove index.php from the url.  Here are the steps:

1. I first enabled the rewrite in Admin>System>Configuration>Web>Search Engine Optimization>Use Web Server Rewrites

2. I also enabled mod_rewrite in apache2 in the terminal with: sudo a2enmod rewrite and then restart apache2 with sudo /etc/init.d/apache2 restart
I checked that mod_rewrite is enabled in the directory: /etc/apache2/mods-enabled/rewrite.load

At this point, I can properly display the homepage without the index.php in the home url. All is well until I click on any product category or any link, the index.php in the url is removed but I receive a 404 error.  If I manually type in the index.php in the address bar, I can navigate to the page.

After searching the forum on this problem, people having the same problem resolved it with .htaccess. Here’s what I did:

3. I copied the content of .htaccess.sample in the magento root and paste it to a new file called .htaccess in the same directory.

4. I uncommented the statement: “RewriteBase /magento/” and change it to “RewriteBase /” since my magento directory is already the root

This didn’t resolve the problem, I still have the 404 error. I search the forum again, and tried:

5.  I issued the command in terminal to edit http.conf: sudo gedit /etc/apache2/httpd.conf and paste the following in the file
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the “default” to be a very restrictive set of
# features. 
#
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>

After restarting apache2, I’m still having the same 404 error.  Another search in the forum and

6. I refreshed the catalog cache in Admin>Cache Management>Catalog Rewrites>Refresh

But I still have the same 404 error when I clicked on the category page or any other links in the homepage. What could be the problem and how do I fix this? Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

I finally resolved the problem after many hours.  After reading about .htaccess a bit in http://httpd.apache.org/docs/2.0/howto/htaccess.html, I realized that there might be some other configuration files that I needed to check.  It turned out that the site configuration file in /etc/apache2/sites-available had the AllowOverride directive set to None. I edited this to “AllowOverride All”, restarted apache2, and voila, it works!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Co
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2008-11-25
Switzerland
 

Hi,
I’m having the same problem, but I can’t seem to find the file to edit (I do not have a etc/apache2/sites-available structure).
It’s pretty annoying because I can’t view product categories without manually typing index.php
Thanks in advance for the help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
greenflame
Jr. Member
 
Total Posts:  5
Joined:  2009-01-11
 

I also am having the same problem even though I have made sure that I have taken the necessary measures to allow rewrites and so on.

Someone please help!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
MAtt*!
Jr. Member
 
Total Posts:  10
Joined:  2008-07-30
 

My issue was resolved by changing my httpd.conf file to Allow Overide All under the ‘Allow Overide controls what directives may be placed in the .htaccess file.

Hope this helps someone

 
Magento Community Magento Community
Magento Community
Magento Community
 
lovevioletrose
Jr. Member
 
Total Posts:  1
Joined:  2008-11-06
 
zhlmmc - 04 November 2008 10:06 PM

Hi Sindre,

Thanks for your reply. I check my configurations, there is no “index.php”.



Hailong

 
Magento Community Magento Community
Magento Community
Magento Community
 
anderl
Jr. Member
 
Total Posts:  1
Joined:  2009-05-22
 

My .htaccess file had the following entry:

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

#RewriteBase /magento/

I deleted # and magento/
So my new row looks like
RewriteBase /

And so that works.

Greetings
Andi

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3