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 2
How do I remove /index.php/ from the admin URL. 
 
Rod_C
Member
 
Total Posts:  33
Joined:  2009-02-16
 

Ok here’s my problem.
I have Magento installed in a subdirectory in my root folder so it looks like this /root/magento/

I have a .htaccess file to make my domain to point directly to that folder that looks like this:

RewriteEngine on
RewriteCond 
%{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/magento/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
^(.*)$ /magento/$1
RewriteCond 
%{HTTP_HOST} ^(www.)? mydomain.com $
RewriteRule ^(/)?$ magento[L]

The problem occurs when I try to access the admin area because the “web server rewrites” that is turned on in the admin area only works for the frontend. So the /index.php/ is still in the admin URL which won’t allow me to access the admin area. (I get 404)
I can delete /index.php/ from the URL and reload the page and I can get it but every time I click anything in admin it puts it right back in there.

Can anyone tell me either how to turn on web server rewrites for the admin URL or if there is anything I can add to my .htaccess file to remove the /index.php/

The URL Currently reads: http://www.mydomain.com/index.php/admin
But needs to read: http://www.mydomain.com/admin

 
Magento Community Magento Community
Magento Community
Magento Community
 
jbova
Member
 
Avatar
Total Posts:  42
Joined:  2008-07-17
New Ringgold, PA, USA
 

Hi Rod_C,

<IfModule mod_rewrite.c>

## enable rewrites
   
Options +FollowSymLinks
   RewriteEngine on

## Rewrite to subfolder magento
   
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.cxm$
   
RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond 
%{REQUEST_FILENAME} !-d
   RewriteRule 
^(.*)$ /magento/$1
   RewriteCond 
%{HTTP_HOST} ^(www.)?mydomain.cxm$
   
RewriteRule ^(/)?$ magento[L]

## All other rewrite rules apply to magento folder
   
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

## never rewrite for URI beginning with admin
    
RewriteCond %{REQUEST_URI} !^/admin.*

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

## externally rewrite index.php/admin to admin
    
RewriteCond %{REQUEST_URI} ^/index.php/admin.*$
    
RewriteRule ^index.php/admin(.*) /admin$1 [R]

</IfModule>
 
Magento Community Magento Community
Magento Community
Magento Community
 
raven
Jr. Member
 
Total Posts:  10
Joined:  2008-07-08
Philippines
 

Has anyone tried jbova’s htaccess approach? It doesn’t seem to work in my part.  long face

 
Magento Community Magento Community
Magento Community
Magento Community
 
jbova
Member
 
Avatar
Total Posts:  42
Joined:  2008-07-17
New Ringgold, PA, USA
 

Please refer to this thread
http://www.magentocommerce.com/boards/viewthread/34357/

Thanks,
Jim

 
Magento Community Magento Community
Magento Community
Magento Community
 
quickcrx702
Jr. Member
 
Avatar
Total Posts:  1
Joined:  2009-07-12
 

Just wanted to say thank you to jbova for that code, it works like a champ!  I haven’t been able to access the admin panel and was using phpmyadmin to make changes to the database until I found your code, which is not quite as friendly as the admin panel but works in a pinch.  Funny thing about moving my magento site into a subdomain is that from what I could tell, everything BUT the admin panel was still working???  One thing I want to add in case anyone else is in the same situation as me, is that if you are hosting multiple domains on one account and using this code is that the other mod_rewrite directives for your other domains need to appear before the magento related rewrites, otherwise the other sites go nuts due to the rewriteBase directive.  Thanks again!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nautica
Sr. Member
 
Avatar
Total Posts:  140
Joined:  2008-01-03
 

I cant get it to work.
I also looked in this thread:
http://www.magentocommerce.com/boards/viewthread/34357/

My website shows the frontend without index.php in the URL but in Backend i can loging with Mywebsite/admin and get the log inscreen
But after logging it should show the dashboard but it gives a 404 error and i see the link like this:
http://www.mywebsite/index.php/admin/dashboard/index/key/37d64f150eb591e01a736715c5be45d2/

If i remove index.php from the url in the addressbar the site works.

I tried all options that where discussed in this and the other thread but cannot find a solution.

This is my situation:

On my server i run 4 websites. The files of each website are stored in their own folders.
The folders residing in the server root are:
website1.nl
website2.be
website3.eu
website4.com

In de server root I have this .htaccess:

####ERROR_HEADER####
#ErrorDocument 400 
#ErrorDocument 401 
#ErrorDocument 402 
#ErrorDocument 403 
#ErrorDocument 404 
#ErrorDocument 500 
#ErrorDocument 501 
#ErrorDocument 502 
#ErrorDocument 503 
####ERROR_TAILER####

php_value upload_max_filesize 30M
php_value post_max_size 30M



RewriteEngine On
#Rule-0
RewriteCond    %{HTTP_HOST}    ^www.website1.nl$    
RewriteCond    %{REQUEST_URI}    !^/website1.nl/    
RewriteRule    (.*)    /website1.nl/$1    

#Rule-1
RewriteCond    %{HTTP_HOST}    ^www.website2.be$    
RewriteCond    %{REQUEST_URI}    !^/website2.be/    
RewriteRule    (.*)    /website2.be/$1    

#Rule-2
RewriteCond    %{HTTP_HOST}    ^www.website3.eu$    
RewriteCond    %{REQUEST_URI}    !^/website3.eu/    
RewriteRule    (.*)    /website3.eu/$1    

#Rule-3
RewriteCond    %{HTTP_HOST}    ^www.website4.com$    
RewriteCond    %{REQUEST_URI}    !^/website4.com/    
RewriteRule    (.*)    /website4.com/$1


####ACCESS_HEADER###
<LIMIT GET POST>
</
LIMIT>
####ACCESS_TAILER###

The settings in magento are:
Configuration>web>SEO URLS switched to ON.
The .htaccess of the Magento website i changed:

#RewriteBase /magento/

to

RewriteBase /website3.eu/

I dont mind seeing index.php in the admin URL but i just don’t want the 404 page.

Any help is welcome

 
Magento Community Magento Community
Magento Community
Magento Community
 
FetchDesigns
Sr. Member
 
Avatar
Total Posts:  124
Joined:  2008-04-11
Chicago, IL
 

I am having this same exact issue with my main domain being in a subdirectory of my host (Hostmonster).  I was able to see the redirect work perfectly on my test site of dev.mydomain.com but it won’t work on my live site at http://www.mydomain.com.  I am at my wits end.  Is there any other fix that can solve this problem?!

i have resorted to running my store from a subdmain until I can get this resolved… sigh… any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Artega Imports
Sr. Member
 
Avatar
Total Posts:  78
Joined:  2010-02-03
Liverpool, England, UK
 

Try this fix .... it takes 5 seconds of your time

HERE

 
Magento Community Magento Community
Magento Community
Magento Community
 
hexagram
Jr. Member
 
Total Posts:  23
Joined:  2009-01-08
 

I have magento in a subdirectory, and this is how I did it…

RewriteRule ^admin/(.*)$ /magento/index.php/admin/$1 [L]
RewriteRule 
^index.php/admin/(.*)$ /admin/$1 [L,R]

Edit: Nevermind. It works, but doesn’t let you save any settings.

 
Magento Community Magento Community
Magento Community
Magento Community
 
FetchDesigns
Sr. Member
 
Avatar
Total Posts:  124
Joined:  2008-04-11
Chicago, IL
 
www.catervino.com - 13 April 2010 01:13 AM

Try this fix .... it takes 5 seconds of your time

HERE

I already have that option set and it hasn’t helped. :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
clockworkgeek
Sr. Member
 
Avatar
Total Posts:  79
Joined:  2009-07-31
 

I also needed to remove index.php so I created this extension:
http://www.magentocommerce.com/extension/3692/

Enjoy!

 
Magento Community Magento Community
Magento Community
Magento Community
 
FetchDesigns
Sr. Member
 
Avatar
Total Posts:  124
Joined:  2008-04-11
Chicago, IL
 

Oh my!  That solved all my problems… thank you so much!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Skivers
Jr. Member
 
Total Posts:  26
Joined:  2008-11-13
 

Its working perfectly on my local machine.. grrrr

 
Magento Community Magento Community
Magento Community
Magento Community
 
FetchDesigns
Sr. Member
 
Avatar
Total Posts:  124
Joined:  2008-04-11
Chicago, IL
 
clockworkgeek - 25 May 2010 05:13 AM

I also needed to remove index.php so I created this extension:
http://www.magentocommerce.com/extension/3692/

Enjoy!

Since installing this extension my MagentoConnect no longer works… I get a 404 error.  Has anyone else had this problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
clockworkgeek
Sr. Member
 
Avatar
Total Posts:  79
Joined:  2009-07-31
 
FetchDesigns - 02 June 2010 08:50 AM

Since installing this extension my MagentoConnect no longer works… I get a 404 error.  Has anyone else had this problem?

Stephanie,

I haven’t been able to recreate that 404. Are you still experiencing it and if so, may I help?

 
Magento Community Magento Community
Magento Community
Magento Community
 
clockworkgeek
Sr. Member
 
Avatar
Total Posts:  79
Joined:  2009-07-31
 

Sorry, double post.

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