ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Odd issue with mod_rewrite and templates

May 26, 2011 4:26pm

Subscribe [2]
  • #1 / May 26, 2011 4:26pm

    antiuser

    44 posts

    I’m using mod_rewrite to remove index.php from urls - a pretty simple thing that I’ve done loads of times before successfully - but this time it’s giving me really weird results. I have my stylesheets and javascript all in the same template group as the rest of the site, but no javascript or css templates ever load. They are there if I use index.php to access them, but will not load otherwise. Has anyone ever come across this before?

    Here’s my rewrite rule if it helps:

    RewriteEngine on
    RewriteBase /
    RewriteCond $1 !^(images|lm_system|themes|favicon\.ico|robots\.txt|index\.php) [NC]
    RewriteRule ^(.*)$ /index.php?/$1 [L]
  • #2 / May 27, 2011 5:30am

    John Henry Donovan

    12339 posts

    Hi antiuser,

    We actually do not support the removal of index.php by htaccess in the Technical Support forums.
    I am moving this thread to Community Help for you as more appropriate there.

    There is also a community written article on the process in our Wiki which may help

  • #3 / May 27, 2011 3:44pm

    antiuser

    44 posts

    Thanks. I did read that article, but nothing on there seemed to work?
    I should add that my site is built around the Structure module so I only have one single template group, and that I’m not using the EE css tag because my stylesheets use EE variables inside them, so I’m just doing straight {site_url}style.css

    The same issue is occurring with my javascript templates - so in short, anything that isn’t a “web page” template returns a 404, but can be accessed through index.php.

  • #4 / Jun 01, 2011 7:43pm

    antiuser

    44 posts

    Did a bit more testing and narrowed it down to it being the dot “.” on the template name that screws with the rewrite. For example, http://domain.com/style loads, but not http://domain.com/style.css. Changing the rewrite rule flag to [R=301] works, but defeats the purpose as that rewrites the url in the address bar - but it does show that the rule itself is correct, which leads me to believe it’s something in EE that’s causing it not to work. Any help would be appreciated…

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases