0

I have a ServerPilot server, running on Ubuntu 16.04.3

On it is an app that is a Wordpress website, but has other non-wordpress directories. In these directories is what I am concerned about.

I have verified that mod_speling is indeed enabled on the server... however, when I put in the

CheckCaseOnly on CheckSpelling on 

to my apps .htaccess file, the case insensitive URL's still resolve as Wordpress 404's instead of actually resolving.

Unfortunately, the site is in test/QA phase so I cannot give the actual URL, however, as an example:

https://www.example.com/university/Smartapp/External/index.html resolves properly, because in the app, that path is exactly that, with the capital S and capital E... however... the URL https://www.example.com/university/smartapp/external/index.html throws the Wordpress 404 Page Not Found

What can I do to get this working?

EDIT So close... I think what is happenning is Wordpress is processing first.

So... I implemented the following:

CheckCaseOnly On CheckSpelling On <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/university/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/events/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/Videos/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/2017-holiday-card/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/Holiday-Card/(.*)$ [OR] RewriteRule ^.*$ - [L] </IfModule> # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L] # END WordPress 

And ServerPilot's default nginx config for the app is:

location / { proxy_pass $backend_protocol://$backend_host:$backend_port; } 

I thought to do something like:

location ~* ^/university/ { proxy_pass $backend_protocol://$backend_host:$backend_port; } 

but it too does not seem to do anything...

Which, does indeed allow the case insensitive URL's to work... however, it does break Wordpress's permalinks, as all inner pages of the wordpress side now 404

ServerPilot processes requests as such: Web Browser -> Nginx -> Apache -> PHP-FPM, please leave the nginx tag on the question since it is relative to it. 
9
  • Do you really need to do this at all? It violates the HTTP specification and makes your server a bit unpredictable. It's much better to fix the broken links. Commented Feb 21, 2019 at 15:25
  • It may be better, however, who is going to pay to have someone fix 900,000+ broken links? When it all worked fine when it was on a windows server? No-one... hence, I ask Commented Feb 21, 2019 at 19:42
  • Yes, that's one of the few legitimate reasons to use mod_speling. But the case of the broken links still needs to be fixed; it's only a workaround so that you don't have 404s when you move away from Windows. The internal links can be fixed with automation, so it doesn't matter much how many there are. It's the external links that should keep you awake at night. Commented Feb 21, 2019 at 20:28
  • webmasters.stackexchange.com/a/44059/17007 Commented Feb 22, 2019 at 2:27
  • 2
    @MichaelHampton The other reason that systems administrators may be forced into doing all this is when the web developers are coming from a Windows background and they expect the violations of the HTTP specs to be the norm. Commented Feb 22, 2019 at 15:39

1 Answer 1

0

Ended up having to forgo .htaccess for this to work

What does the trick is adding:

<DirectoryMatch "(^|/)university($|/)"> CheckCaseOnly On CheckSpelling On RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/university/(.*)$ [OR] RewriteRule ^.*$ - [L] </DirectoryMatch> 

to the vhost config for the app

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.