3

When I login to admin panel I get sent to: http://example.com/index.php/admin/index/index/key/**********

and get 404 error

but when I remove "/index.php" from the url: http://example.com/admin/index/index/key/**********

it works but every time I click a link in admin panel the index.php comes back

I am pretty much having the opposite problem as this guy: https://stackoverflow.com/questions/10474740/how-to-remove-index-php-from-urls

whereas his links did not add index.php to the url, but his pages required them, my links are adding index.php to the url when the pages do not accept them

3 Answers 3

3

I gave up on finding help online, so I took it upon myself to find the answer. I eventually made an edit that fixed everything also note, if you have magento installed in a subdirectory, make sure folders that contain the magento installation do not have an .htaccess of their own or else it will conflict with the .htaccess in your magento root

Here is my magento root .htaccess:

   DirectoryIndex index.php

<IfModule mod_php5.c>

    php_value memory_limit 256M
    php_value max_execution_time 18000

    php_flag magic_quotes_gpc off

    php_flag session.auto_start off

    php_flag suhosin.session.cryptua off

    php_flag zend.ze1_compatibility_mode Off

</IfModule>

<IfModule mod_security.c>

    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_deflate.c>

</IfModule>

<IfModule mod_ssl.c>

    SSLOptions StdEnvVars

</IfModule>

<IfModule mod_rewrite.c>

    Options +FollowSymLinks
    RewriteEngine on

    RewriteBase /

    RewriteRule ^api/rest api.php?type=rest [QSA,L]

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

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

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

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

    RewriteRule .* index.php [L]

</IfModule>

    AddDefaultCharset Off

<IfModule mod_expires.c>

    ExpiresDefault "access plus 1 year"

</IfModule>

    Order allow,deny
    Allow from all

    <Files RELEASE_NOTES.txt>
        order allow,deny
        deny from all
    </Files>

RewriteRule ^index.php/(.*)$ [L] 
0
2

Another method of doing this does involve modifying a core Magento file (which is a big no, no for upgrading purposes) but works all the same: http://www.code007.ro/magento-how-to-remove-index-php-from-admin-url/

Obviously test within a test environment and create a copy of the modified file in the local directory rather than editing the core file itself as outlined in the article.

I have this working on a local dev server but not on a production nginx server so approach with causion!

0

If you want to access your magento URL without index.php for example:

http://domain.com/index.php/category

to

http://domain.com/category

then use the following steps 1) Login to admin section by using the URL

http://domain.com/index.php/admin

2) then go to “System >> Configuration >>Web >> Search Engines Optimization

Use Web Server Rewrites : YES

3) Go to “System >> Configuration >>Web >>Secure

Use secure URL Frontend: YES

4)Then create the .htaccess file under your the magento installed folder. If the magento installed under document root (/home/username/public_html) then add follogig rules into .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

and If the magento installed under /shop or directory then add the following rules into ” /home/username/public_html/shop/.htaccess ” file.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /shop/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /shop/index.php [L]
</IfModule>

Done

2
  • Whenever I click a link in admin, I get sent to the link with index.php in between example.com/*/admin so if I try to change Use secure URL Frontend: to YES then it posts the data I am trying to change to the wrong URL and it doesn't end up modifying anything. I know the workaround is to go change this information in the database but judging that you think that that would work, I can rather safely assume that you don't understand the problem I am having. I don't WANT to remove index.php from the url, I NEED to to make it work. Bare in mind this ONLY occurs in my magento admin panel. Thanks!
    – Boonda P
    Apr 23, 2015 at 16:41
  • @Charlie: That does not work for the admin store (adminhtml backend).
    – hakre
    Apr 1, 2016 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.