web server upgrade broke SEO URLs

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

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: 

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

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

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