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

web server upgrade broke SEO URLs - RESOLVED

By Deborah - July 11, 2017

Hi, Dave.

I forwarded your suggestions to the server admins and the server issue has been resolved!

The setup: NGINX 1.10.0 with an ISPConfig 3.1.2 control panel.

To allow for the SEO URLs, it was necessary to add in the ISPConfig redirect section the following rule:

rewrite (.*php)\/(.*)-([0-9]+) /$1?num=$3 break;

Not the most common hosting setup, but maybe someone else will encounter the same issue someday, so thought I'd share.

Thanks for your good advice! I think it probably helped the server admins arrive at this solution.

~ Deborah

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