web server upgrade broke SEO URLs

6 posts by 2 authors in: Forums > CMS Builder
Last Post: July 11, 2017   (RSS)

By Deborah - July 5, 2017

The server one of my client sites is hosted on was upgraded without our advance knowledge and it has broken any SEO-friendly links.

This link method longer works:
http://www.domain.com/classes/department.php/num-7/

... but the basic link method does work:
http://www.domain.com/classes/department.php?num=7

The CMSB documentation for SEO URLs states "This is not supported on all web servers." I can revert the urls to the basic format, but would prefer not to.

My question is, could this be remedied by asking the server admins to install or enable something for Apache or PHP?

~ Deborah

By Dave - July 5, 2017

Hi Deborah, 

Yes, there's an Apache directive for allowing what's called "PATH_INFO".  Here's the Apache docs: 
https://httpd.apache.org/docs/2.4/mod/core.html#acceptpathinfo

If your host lets you create .htaccess files, try adding this to an .htaccess file in the root of your website: 

AcceptPathInfo On

Or if that doesn't work you can ask them to add it to the Apache config file for your website.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By Deborah - July 6, 2017

Dave, thanks for the advice.

I first tried the htaccess tip, with no success. Then checked with the server admins and learned that the upgrade included switching to an nginx-based web server, so Apache-based fixes don't apply.

They created the nginx redirect below for testing, but weren't sure if it would work - and it does NOT.

I'm not versed in regular expressions. I'm wondering if you have an eye for this, could you please tell me if you think it looks right? (The first line is one they use for WordPress sites, so it may not be needed.)

if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}

rewrite ^(.*\.php)(\/num-(\d)\/)(.*)$ $1\?num=$3$4 last;

All is not lost if I can't use the seo URLs, but it would certainly be preferred. And I have a second site I'm bidding on that would run on the same server, so I'd like to know the limitations before starting that project.

Thanks again for your help.

~ Deborah

By Dave - July 6, 2017

Hi Deborah, 

Hmm, I'm not sure about that one.  It looks like it's hardcoded to work with specific filenames only.

I'd just google for: Nginx AcceptPathInfo

One of the first results has some generic code here: https://stackoverflow.com/a/30778310

But they'll need to try them and confirm it works. I think they can also pass certain requests (eg: php files) through to Apache.  I know we use Plesk and it comes bundled with nginx and Apache.  With static requests (images, etc) getting handled by nginx and dynamic pages such as php being handled by Apache. Reference: https://docs.plesk.com/en-US/onyx/administrator-guide/web-servers/apache-web-server-linux/apache-with-nginx.70837/

But we're getting into Server Admin issues here so I'm not the expert.  They should definitely be able to find a way to resolve it though as it's a common problem (as evidenced by the number of google posts about it).

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

web server upgrade broke SEO URLs - RESOLVED

By Dave - July 11, 2017

Thanks! Glad you got it working and thanks for sharing the code.  Cheers!

Dave Edis - Senior Developer
interactivetools.com