Welcome Guest, Not a member yet? Register   Sign In
redirect a PHP suffix to a controller using Apache mod_rewrite / RewriteRule
#9

[eluser]tmcallister[/eluser]
[quote author="bretticus" date="1253744936"]I never used the suffix feature before so I thought it was optional. Smile

Okay, so I got stubborn and made this work:


Code:
RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteRule ^post_here.php$ /index.php?/user/journal [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]

The difference was putting it above the exceptions for accessing a real file or directory. NOTE: this is part of my apache config (not .htaccess) your mileage may vary.[/quote]


Previously I tried putting it above the exceptions with no luck, but let me thoughtfully review your suggestion here. Thanks, I'll report back later today.


Messages In This Thread
redirect a PHP suffix to a controller using Apache mod_rewrite / RewriteRule - by El Forum - 09-23-2009, 12:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB