0

I'm trying to set up a development site with a specific development URL. The development site is a clone of a live site, but I'm not able to get the htaccess code to work to remove index.php.I've tried all the configuration options I can find*, but nothing is working. This is the first time I've never been able to get this to work. The development server has a non www url (ie http://dev-domain.com). Could this be a problem?

<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]
</IfModule>

*ie adding '?' to index.php, removing the first slash, changing system to the actual system name, trying the $config['uri_protocol'] options. All to no avail.

0

I have one system using a non www domain setup and I use the following to handle the index.php rewrite

#strip index.php from the URL if that is all that is given
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://%{HTTP_HOST}/
[R=301,NS,L,QSA]

#strip index.php/* from the URL
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php/ [NC]
RewriteRule ^index\.php/(.+) http://%{HTTP_HOST}/$1 [R=301,L,QSA]

For the other web requests, your code is the same as mine, except I need to use a question mark after index.php

RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]

One other thing that may be worth noting, in my environment I am not using ReWriteBase / and I wonder if that could be your issue.

| improve this answer | |
0

Turns out that htaccess had not been enabled in the hosting account. For the benefit of anyone else: checking the PHP settings to see if mod-rewrite was enabled was still positive even though htaccess was not enebaled. Trying to deliberately force a server error (by putting random text in the file) using htaccess to check if it was enabled did nor work either. The simple trick that worked was to use a redirect to see if htacces was working or not.

| 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.