Additional Page Pretty URLs not working correctly

Permalink 1 user found helpful
I'm having a weird problem with pretty URLs.
Canonical URLs work fine, but additional URLs seem to redirect to a non-pretty URL.

Here's an example:
http://www.smwc.edu/distance <- takes you to the correct page.
http://www.smwc.edu/woodsonline... <-- takes you tohttp://www.smwc.edu/index.php/distance/woodsonline....

The Canonical URL for /woodsonline is /distance/woodsonline

Any suggestions on how to remove /index.php?

glockops
 
glockops replied on at Permalink Reply
glockops
Which file controls redirects from additional page URLs to the canonical URLs?
bryanlewis replied on at Permalink Reply
bryanlewis
Go to your dashboard->sitewide settings-> and under the "linking" tab make sure you have "Enable Pretty URLs" checked. Then follow the htaccess directions. you will have to make sure you have your pretty url's set for each page in its properties.
glockops replied on at Permalink Reply
glockops
Pretty URLs are enabled and working.

It is the additional page URL redirects that seem to be avoiding the pretty URL function.

Again, examples in the original post:
http://www.smwc.edu/distance - pretty URL works find.

http://www.smwc.edu/woodsonline... - pretty URL fails to properly redirect to the canonical URL -http://www.smwc.edu/index.php/distance/woodsonline
ryan replied on at Permalink Reply
ryan
/concrete/dispatcher.php
/concrete/libraries/view.php
.htaccess

chances are you'll find what you're looking for in view

Let us know what you find.
glockops replied on at Permalink Reply
glockops
I think I found the offending code
/concrete/libraries/view.php
starting at line 383 (part of the function url
if ((!URL_REWRITING_ALL) || !defined('URL_REWRITING_ALL')) {
$dispatcher = '/index.php';
}


When additional page URLs get redirected to their canonical URLs this executes. I added an additional slash in the dispatcher '//index.php' and when I typed an additional page URL in:
http://www.smwc.edu/handbook
it redirected to the canonical URL in this manner
http://www.smwc.edu//index.php/student_handbook/...

My .htaccess file has the code from the dashboard in it, all other pretty URLs (based off of canonical URLs work fine) - it's just these blasted additional page URLs that are screwing me up.

If I recall correctly the redirect function is relatively new and was done to improve SEO (by only providing Google with a single URL per page) - but it seems to have missed the tie in with pretty URLs.

So I've either screwed up some core C5 code, or the redirect function isn't taking in account additional page URLs, which is failing the mission of only providing Google with a single URL because as it stands, it provides it with two:
The original canonical URL
http://www.smwc.edu/student_handbook/...
and the redirect URL from additional page URLs:
http://www.smwc.edu/handbook/
Which translates to:
http://www.smwc.edu/index.php/student_handbook/...
ryan replied on at Permalink Reply
ryan
<?php
echo var_dump(URL_REWRITING_ALL);
?>


I'm betting that's false.

add this to your config/site.php & undo any changes you made to your view.php

define('URL_REWRITING_ALL',true);
glockops replied on at Permalink Reply
glockops
Thanks Ryan!
The var_dump reported URL rewriting was false.

Adding the link in site/config.php fixed it!

Many thanks!