1

I have a site running in a sub-directory and I'm using this htaccess:

<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/*(.*) helpdeskzorgaanbieders/$1$2 [R=301,NE,L]

        # Removes redirect to url without www
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

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

</IfModule>

It's conform the Ellilad user guide, i just put some extra code for redirect url with www to a url without www:

    # Removes redirect to url without www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

I don't know why but if I test and add www. to the URL it send me back to the root directory (where an other EE site is also running).

Something must be wrong in my code but I can't find it.

2

Problem is solve, I did change the code this way:

 # Removes redirect to url without www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/namesubdirectory/$1 [R=301,L]

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.