0

I'm missing something really simple... I have an MSM site that is subdomain.domain.com. These really simple .htaccess rules work ... kind of.

RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)/index\.php/*(.*) /$1$2 [R=301,NE,L]

RewriteCond $1 !\.(gif|jpe?g|png|swf|pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php/$1 [L]

The template routes work fine. For example, I have set a home template group at pages with index and non-index named templates. If you visit subdomain.domain.com/pages/index, it works just fine. Same with subdomain.domain.com/pages/non-index.

Now, I've set the pages template group to be the site home group, remember:

Make the index template in this group your site's home page? **Checked !!**

But when I visit subdomain.domain.com, I get:

Error

The page you requested was not found.

Soooo... these routes all work:

https://subdomain.domain.com/index.php/ ->
    loads pages/index

https://subdomain.domain.com/pages ->
    loads pages/index

https://subdomain.domain.com/pages/non-index ->
    loads pages/non-index

https://subdomain.domain.com/index.php/pages ->
    loads pages/index

https://subdomain.domain.com/index.php/pages/non-index ->
    loads pages/non-index

But yet the pages/index doesn't render on the homepage. I get the EE page not found error.

I've made sure my site_url is set to https://subdomain.domain.com, and that the name of my site index is blank.

I've tried a few variations on the last RewriteRule line (adding the question mark), but those either render the same or result in the issue where only the homepage renders for URLS (so https://subdomain.domain.com DOES load pages/index, but so does https://subdomain.domain.com/pages/non-index).

Like I said, I've tried a bunch of variations of rules to remove index.php and a variation of rules to route everything to index.php after removing it. Any one notice anything stupid I'm missing?

Edit Like I mentioned, modifying the last rewrite to something like:

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

# or
RewriteRule ^(.*)$ /index.php?$1 [L]

# or (subdomain.domain.com is a folder in the web root)
RewriteRule ^(.*)$ /subdomain.domain.com/index.php?/$1 [L]

# or
RewriteRule ^(.*)$ /subdomain.domain.com/index.php?$1 [L]

# or any of those with the QSA flag

results in the issue where only the site index template renders.

Edit Last edit:

Here's how I load my subdomain folder from my main web root so this subdomain loads the MSM subdomain site. This is at the top of my web root .htaccess file.

RewriteCond %{HTTP_HOST} ^subdomain.domain.com [NC]
RewriteCond %{REQUEST_FILENAME} !subdomain.domain.com/
RewriteRule ^(.*)$ /subdomain.domain.com/$1 [L]

That has worked fine in other sites I've worked on and looked at.

0

Ugh, so turning off Strict URLs fixed this issue. If anyone else has this issue and doesn't think to tick that off, try it.

If anyone reads through this and feels like commenting, please let me know if turning off Strict URLs has resulted in any issues, especially security ones, in your experience.

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