Welcome Guest, Not a member yet? Register   Sign In
SEO / USER friendly urls won't work.
#1

Hi there,

I am trying to figure out why our website www.webuyback.com.au won't display User friendly / Seo friendly URL's .

I am pasting the URL title code from url_helper.php file down here

if ( ! function_exists('url_title'))
{
function url_title($str, $separator = '-', $lowercase = FALSE)
{
if ($separator == 'dash')
{
$separator = '-';
}
else if ($separator == 'underscore')
{
$separator = '_';
}

$q_separator = preg_quote($separator);

$trans = array(
'&.+?;' => '',
'[^a-z0-9 _-]' => '',
'\s+' => $separator,
'('.$q_separator.')+' => $separator
);

$str = strip_tags($str);

foreach ($trans as $key => $val)
{
$str = preg_replace("#".$key."#i", $val, $str);
}

if ($lowercase === TRUE)
{
$str = strtolower($str);
}

return trim($str, $separator);
}
}


Still whenever I create aproduct, the url looks like this : http://www.webuyback.com.au/sell_your_phone/159

Any help would be highly appreciated.
Reply
#2

(This post was last modified: 08-28-2015, 09:22 AM by CroNiX.)

Check out the $route['translate_uri_dashes'] = FALSE; setting in /application/config/routes.php and try changing it to TRUE.

https://github.com/bcit-ci/CodeIgniter/b...es.php#L54

If a request comes in with dashes, like http://yoursite.com/some-fancy-url/some-fancy-method, AND there is a "Some_fancy_url" controller (with underscores obviously) with a "some_fancy_method" method, it will automatically route there.
Reply
#3

I have pretty much tried all that I could by looking at the user manuals and going through the files.

COuld someone please help me out here? Any help will be much appreciated.
Reply
#4

What do you want the URLs to look like? What are the names of the relevant controller and method? What routes do you have configured?

If we don't know what the URL helper looks like, we can look it up, but you've given us no explanation of why you pasted the code for a function in the helper and no real idea of what you're trying to accomplish. Your URLs are created by a combination of your routes, controllers, and the methods in those controllers. If your controller's method expects an ID value as a parameter and you want to pass in some arbitrary string to match against a field in your data, then you need to change the controller method to handle that appropriately.
Reply
#5

One of the main reasons people are using SEO friendly URLs is to avoid appearing duplicate pages. Unfortunately sometimes using "SEO friendly URLs" creating even more problems. Mwhitney is right, we have to know more before giving you any advice.
I've finally created my first website
Reply




Theme © iAndrew 2016 - Forum software by © MyBB