Welcome Guest, Not a member yet? Register   Sign In
routing question
#11

[eluser]WebsiteDuck[/eluser]
I think that would be easiest
#12

[eluser]dadamssg[/eluser]
i guess my question is...how do i exclude 'main' from being redirected?
#13

[eluser]dadamssg[/eluser]
im beginning to question where i shouldve put the CodeIgniter folder. I put as a folder at my root next to my index.php frontpage. Should i have just put the System folder found within the CodeIgniter there instead? I say this because all of my urls have the CodeIgniter folder in them like below

http://myexample.com/CodeIgniter/index.php/form
#14

[eluser]WebsiteDuck[/eluser]
You'll have to use regular expressions
Code:
$route['(^[^(main)])'] = "controller/function/$1";

I don't think that works, I'm not very good at regular expressions
#15

[eluser]WebsiteDuck[/eluser]
As for the codeigniter folder question, you can get around that with an .htaccess file
Code:
<IfModule mod_rewrite.c>
    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} ^codeigniter/system.*
    RewriteRule ^(.*)$ /codeigniter/index.php?/$1 [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 ^(.*)$ /codeigniter/index.php?/$1 [L]
</IfModule>

This says, if the request is not a valid file or folder, send it to /codeigniter/index.php

Then, instead of http://myexample.com/CodeIgniter/index.php/form you can do http://myexample.com/form
#16

[eluser]mcr_rm[/eluser]
I think you need to do far more complex routing than that. I think you would need to overide the default index routing using remap http://ellislab.com/codeigniter/user-gui...#remapping then pass the paramter through a method created in a model or otherwise to check if a user exists then if not check for other methods that could exist (for standard page routing).

I have done something before outside of codeigniter that does this whereby we mod rewrite to index and first parse the routing against pages in the system before passing it to a data call to check for a saved custom page.

It would be far easier to create a controller one level down so site.com/u/username but to get what you want and still make a site that can show other pages than profiles you need to do some reworking of the routing. I don't think solely using any to parse a username is good enough.
#17

[eluser]dadamssg[/eluser]
so i add that to my .htaccess file found in my root folder?




Theme © iAndrew 2016 - Forum software by © MyBB