Thread: Issue

  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Rep Power


    Options -MultiViews
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_URI} !((.*).(js|css))$ [NC]
    RewriteRule . index.php [L]
    RewriteCond %{REQUEST_URI} !((.*).(js|css))$ [NC]
    RewriteRule ^([A-Za-z0-9#_\.\$\)\(\*\^]+)/?$ index.php?p=$1 [QSA,L,NC]
    RewriteCond %{REQUEST_URI} !((.*).(js|css))$ [NC]
    RewriteRule ^([A-Za-z0-9#_\.\$\)\(\*\^]+)/([A-Za-z0-9_]+)/?$ index.php?p=$1&s=$2 [QSA,L,NC]
    The above is causing all of my .php to not load. When I try to log out of my site, the page just goes back to the page it was on and has /logout.php in the address bar.

    I need RewriteRule . index.php [L] because my index.php default else statement (this is where my homepage is) won't load without it.
    Last edited by HDFilmMaker2112; June 19th, 2012 at 04:37 AM.
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    USA (verifiably)
    Rep Power
    More general rules need to come after more specific rules. In this case, I would suggest just removing that first one and in the rule that's currently second use the "*" (zero or more) quantifier instead of the "+" (one or more) quantifier.

    By the way, there's an alternative to repeating the same condition over and over again.
    There is a special substitution string named '-' which means: NO substitution! This is useful in providing rewriting rules which only match URLs but do not substitute anything for them.
    You'd use it like the following. This rule should go before the others (even though it's a specific one).
    RewriteRule .*\.(js|css)$ - [L,NC]
    Spreading knowledge, one newbie at a time.

    Learn CSS. | PHP includes | HTML Validator | CSS validator

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo