Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Rewrite only one thing
#1

[eluser]stuffradio[/eluser]
How can I make it so I only have to handle one thing for rewriting and have everything else work properly without index.php?

This is my routes page:
Code:
$route['default_controller'] = "url";
$route['scaffolding_trigger'] = "";
$route['url/geturl/(:any)'] = "url/geturl/$1";
$route['(:any)'] = "url/geturl/$1";
$route['url/(:any)'] = "url/$1";
$route['url/register'] = "url/register/$1";

I'm trying to get the url/geturl($any) to work without typing anything, but it only works when I type url/geturl/blah. So I want http://myurl.com/blah to route to

Code:
$route['(:any)'] = "url/geturl/$1";

but it's not doing it.

Here is my htaccess file

Code:
DirectoryIndex index.php
RewriteEngine on
RewriteBase /phpurl/
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
#2

[eluser]n0xie[/eluser]
Your description of what you are trying to do is rather vague, but if I understand correctly you want all requests to go to one controller/function?
Code:
domain.tld/foo -> domain.tld/url/geturl/foo

If so this should work:
Code:
RewriteRule ^(.*)$ ./index.php/url/geturl/$1 [L,QSA]
#3

[eluser]stuffradio[/eluser]
If someone goes

Code:
domain.tld/foo
I want it to go to
Code:
domain.tld/url/geturl/foo

Otherwise treat everything else normally.


Edit:
Never mind, you solved it for me.

I removed the routes and used that in the htaccess and it works Smile

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB