How to remove "main" from current_url()? |
[eluser]Radiart[/eluser]
I use function current_url() And the result is: http://localhost/break/main/news/27501 But I want: http://localhost/break/news/27501
[eluser]SPeed_FANat1c[/eluser]
you can use uri routing http://ellislab.com/codeigniter/user-gui...uting.html But I guess you are a beginner and if I were you I would try to avoid this, because it is confusing if you have no experience (at least for me it is).
[eluser]Madmartigan1[/eluser]
Radiart, are you simply trying to manipulate the url string or the url itself? current_url() basically just returns the current url, as you would expect. Nothing more. Code: function current_url()
[eluser]Radiart[/eluser]
In URL bar in web browser I see this: http://localhost/break/news/27501 But when I use current_url() I see this http://localhost/break/main/news/27501 On all my website I don't see "main" but when I use current_url() suddenly I see "main" I just want to get current link same like in URL bar. Maybe I must change something in my .httacces file? Code: RewriteEngine on
[eluser]Madmartigan1[/eluser]
That's really odd... What happens when you use this?: site_url($this->uri->ruri_string())
[eluser]Radiart[/eluser]
[quote author="Madmartigan1" date="1293681914"]That's really odd... What happens when you use this?: site_url($this->uri->ruri_string())[/quote] http://localhost/break/main/preview/news/27501
[eluser]Madmartigan1[/eluser]
That's strange. Which bits of that url are directories and which bits are controllers methods and params? Can you explain the url a bit? Can you post your routes.php?
[eluser]Radiart[/eluser]
[quote author="Madmartigan1" date="1293682742"]That's strange. Which bits of that url are directories and which bits are controllers methods and params? Can you explain the url a bit? Can you post your routes.php?[/quote] URL http://localhost/break/news/27501 http://localhost - Everything I testing on local machine I use EasyPHP 5.3.3 break - main folder where I have aplication and system folders news - function in class preview 27501 - id ROUTES $route['default_controller'] = "preview/index"; $route['scaffolding_trigger'] = ''; /* PORTAL */ $route['logowanie'] = "portal/logowanie"; $route['rejestracja'] = "portal/rejestracja"; $route['logout'] = "portal/logout"; ... /* LIST */ $route['polecamy'] = "lista/polecamy"; $route['polecamy/(:any)'] = "lista/polecamy/$1"; $route['newsy'] = "lista/newsy"; $route['newsy/(:any)'] = "lista/newsy/$1"; ... /* PREVIEW */ $route['news/(:any)'] = "preview/news/$1"; $route['wydarzenie/(:any)'] = "preview/wydarzenie/$1"; $route['artykul/(:any)'] = "preview/artykul/$1"; ... /* PANEL */ $route['panel'] = "panel/index"; $route['panel/partnerzy'] = "panel/partnerzy"; $route['panel/edycja/partnera'] = "panel/edycja_partnera"; $route['panel/update/partnera'] = "panel/update_content"; $route['panel/strony'] = "panel/strony"; ... $route['(.*)'] = "preview/page/$1"
[eluser]Madmartigan1[/eluser]
Quote:In URL bar in web browser I see this: Where is "main" coming from? This just makes no sense to me, I don't see it anywhere. If what you're saying is true, then I have no idea.
[eluser]Radiart[/eluser]
Ok I start searching "main" and I found the problem In config.php there was: $config['index_page'] = "main"; I remove it and now it's working Thx =) |
Welcome Guest, Not a member yet? Register Sign In |