Welcome Guest, Not a member yet? Register   Sign In
need help with a mod_rewrite :)
#1

(This post was last modified: 04-02-2015, 11:26 AM by ciadmin.)

[eluser]the real rlee[/eluser]
Hi I\'m using the stock CI mod rewrite to get rid of the \"index.php\" at the start of my URI\'s, but i\'d like to extend this rewrite to make the server redirect any request bar user/... main/.. to a specific controller function. The situation is my main website has a number of subsites which look like www.mysite.com.au/joebloggs which needs to be passed to my Sites controller i.e. www.mysite.com.au/joebloggs - > Sites/index/joebloggs.

Your help greatly appreciated!

Code:
# CI needs PATH_INFO
<Files \"index.php\">
AcceptPathInfo On
</Files>

# Check mod_rewrite is enabled
<IfModule mod_rewrite.c>
# Lets remove index.php from URI...
RewriteEngine On\nRewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If mod_rewrite isn\'t enabled try and
# forward request to index.php

ErrorDocument 404 index.php

</IfModule>
"




Theme © iAndrew 2016 - Forum software by © MyBB