Welcome Guest, Not a member yet? Register   Sign In
URL strings are causing 404
#1

I have two URLS: /admin/booking and /classes-and-courses/holiday-courses?utm_medium=email&utm_campaign=JULY%2016&utm_content=JULY%2016+CID_3572f5077cfca45f9d950f1a0d1834e1&utm_source=Email%20Marketing%20with%20CodeByJoe%20Ltd&utm_term=HERE

My problem is that with AUTO (uri_protocol) the second doesnt work and with PATH_INFO the first url doesnt work.

Is there some .htaccess or additional configuration i need to do to get both urls to work at the same time.

Thanks
Reply
#2

For second problem use $route['translate_uri_dashes'] = TRUE;
Keep calm.
Reply
#3

(07-06-2016, 03:22 AM)arma7x Wrote: For second problem use $route['translate_uri_dashes'] = TRUE;

I put that in the config.php and it didnt change anything?

Also there is only one problem, the ?dsadsa part doesnt work and if it does /admin/booking doesnt work.
Reply
#4

In /application/config/config.php:
PHP Code:
$config['uri_protocol'] = 'REQUEST_URI'

In /application/config/routes.php:
PHP Code:
$route['translate_uri_dashes'] = true

The translate_uri_dashes setting in the routes file allows CI to map something like /classes-and-courses/holiday-courses to a controller named Classes_and_courses and a method named holiday_courses(). You don't necessarily need this setting, though. You can just set the routes manually, like this:

PHP Code:
$route['classes-and-courses/holiday-courses/(:any)'] = 'classes_and_courses/holiday_courses/$1';
$route['classes-and-courses/(:any)/(:any)'] = 'classes_and_courses/$1/$2';
$route['classes-and-courses/(:any)'] = 'classes_and_courses/$1'

The question is, which URL "works" with which setting?

When the classes-and-courses URL doesn't "work", how are you trying to get the query string? For example, have you tried $this->input->get('utm_medium')?
Reply
#5

(This post was last modified: 07-11-2016, 01:34 AM by 0x1027.)

(07-07-2016, 10:00 AM)mwhitney Wrote: In /application/config/config.php:
PHP Code:
$config['uri_protocol'] = 'REQUEST_URI'

In /application/config/routes.php:
PHP Code:
$route['translate_uri_dashes'] = true

The translate_uri_dashes setting in the routes file allows CI to map something like /classes-and-courses/holiday-courses to a controller named Classes_and_courses and a method named holiday_courses(). You don't necessarily need this setting, though. You can just set the routes manually, like this:

PHP Code:
$route['classes-and-courses/holiday-courses/(:any)'] = 'classes_and_courses/holiday_courses/$1';
$route['classes-and-courses/(:any)/(:any)'] = 'classes_and_courses/$1/$2';
$route['classes-and-courses/(:any)'] = 'classes_and_courses/$1'

The question is, which URL "works" with which setting?

When the classes-and-courses URL doesn't "work", how are you trying to get the query string? For example, have you tried $this->input->get('utm_medium')?
basically we are sending marketing emails and the ?<stuff> they auto add at the end just causes a 404, we aren't trying to use query strings.
Reply
#6

If you don't need to access the query string, then you should try getting the configuration to work without it, first, then work your way from there to figure out what's breaking it. In other words, make sure /admin/booking and /classes-and-courses/holiday-courses work before worrying about /classes-and-courses/holiday-courses?utm_medium=email&...
Reply
#7

(07-11-2016, 08:37 AM)mwhitney Wrote: If you don't need to access the query string, then you should try getting the configuration to work without it, first, then work your way from there to figure out what's breaking it. In other words, make sure /admin/booking and /classes-and-courses/holiday-courses work before worrying about /classes-and-courses/holiday-courses?utm_medium=email&...

They do work, but with query strings they dont.
Reply
#8

So, is it any query string that breaks it, or just a specific query string? Have you changed any other configuration values (e.g. 'permitted_uri_chars', 'enable_query_strings', etc.) to attempt to get it to work (if you haven't, I don't recommend changing either of those)? Have you determined whether your error is coming from CodeIgniter or from your server?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB