Jump to:

22975 Posts in 11620 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Useless mod_rewrite rule in the default silverStripe .htaccess ?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1403 Views
  • Myrdhin
    Avatar
    Community Member
    67 Posts

    Useless mod_rewrite rule in the default silverStripe .htaccess ? Link to this post

    Hello,

    In my .htaccess file, i have mod_rewrite rules :

    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$)

    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]

    It's OK, these default rules works. But, i've read in this page about Rewrite rules :

    A wrong assumption is that the conditions are processed before the pattern of the RewriteRule. But this is wrong. The processing order is as follows:

    1 - The Pattern of the RewriteRule is checked first.
    ....

    So, i'm wondering : is RewriteCond %{REQUEST_URI} ^(.*)$ usefull ? It seems to be almost the same as .* pattern of the RewriteRule.

    Perhaps Could we write :

    RewriteEngine On
    RewriteBase /Tests_CMS/SilverStripe

    RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$)

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ sapphire/main.php?url=%1&%{QUERY_STRING} [L]

    thanks for your explanations.

    1403 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.