0

I recently took over from another developer and I'm having some trouble with my .htaccess breaking my admin control panel.

My .htaccess file is as follows:

RewriteEngine On
RewriteRule ^case-studies/(.*) /articles-case-studies/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

<FilesMatch "\.pdf$">
  header set x-robots-tag: noindex
</FilesMatch>

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} !^/php-fpm/*
</IfModule>

which does effectively remove index.php from my urls. The problem I'm having is when I try to log into the back end control panel at:

www.example.com/admin

the page just gets stuck in an infinite redirect loop. What I've noticed is that without removing index.php? when I try to login to www.example.com/admin it redirects to

www.example.com/admin/index.php?/cp/login&return=

What am I missing?

Edit:for grammar mistakes

1

EllisLab says you have to add a special rewrite condition if you rename your system folder:

If your site’s system directory (/system/) has been renamed and is still accessible by URL, modify the RewriteCond line above:

RewriteCond %{REQUEST_URI} !/newdirectoryname/.* [NC]
| improve this answer | |

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.