Missing trailing slash apache wordpress ssl - wordpress

I bought an SSL from comodo, and i used HTTP file auth for the validation process.
placed the .txt file in .well-known/pki-validation/ folder, but the validation is failing as the url leads to www.example.com.well-known/pki-validation/file.txt with the trailing slash missing.
attempted many htaccess codes but its not working. also tried to change the url by adding a trailing slash at the end of the url in wordpress settings but no luck.
any fixes is highly appreciated.

Related

Nginx server not working with trailing slash

I have setup Ubuntu 20.4 with Nginx.
All working fine except following
When someone hit https://www.example.com/webservice.php all working fine as expected.
but If tried to hit https://www.example.com/webservice.php/ then it gives 404 error.
here, It just have extra slash at end.
I already tried to update Nginx default file as follow with rewrite rules
rewrite ^/(.*)/$ /$1 permanent;
However it redirect to webservice.php from webservice.php/
But it just result empty page while it rewriting it doesn't pass it request body there.
Please, any solution?
By adding the slash, you are saying it's a URI pointing at a directory and not the PHP file. There is no directory called webservice.php I presume. Only a file. Therefore, the 404 error. Don't do that.

sitemap URL without trailing slash 404 error

I have wordpress website that I installed google XML Plugin.
all urls with and without trailing slash works properly.
but for sitemap.xml without trailing slash browser return 404 error.
I modified permalinks, .htaccess ,... but it doesn't work.
https://pteceng.com/partners/deltav =>OK
https://pteceng.com/partners/deltav/ =>OK
https://pteceng.com/sitemap.xml/ =>OK
https://pteceng.com/sitemap.xml =>NOT OK

How to write a .htaccess for URL redirect or rewrite for WordPress site?

I am trying to understand regex URL rewrites and redirects.
I need the following:
www.mydomain.com/tag/*/index.html (for example, mydomain.com/tag/winter-holidays/index.html or mydomain.com/tag/summer-holidays/index.html) to redirect to: www.mydomain.com/index.php/tag/WHATEVER/index.html
www.mydomain.com/*/ (for example, www.mydomain.com/four-roots-of-happy-living/, www.mydomain.com/four-roots-of-happy-living (without the ending slash), www.mydomain.com/living/, www.mydomain.com/living (without the ending slash) AND ALSO www.mydomain.com/category/happiness/ and www.mydomain.com/category/happiness (without the ending slash) to redirect to www.mydomain.com/index.php/WHATEVER/ or www.mydomain.com/index.php/WHATEVER/ WHATEVER/.
I have tried so many different combinations in my .htaccess file that my head is spinning now.
In my .htaccess (currently) I had this, but have deactivated it for the meantime until I can get this straight:
Redirect 301 /* /index.php/*
RedirectMatch 301 /*(.*)/? /index.php/$1
Note: My htaccess file was/is in my root directory, my WordPress site is in a wp folder off that, and it did not have a .htaccess file.

Wordpress says page "not found" if includes trailing slash in URL?

For every page on this subdomain, if there is a trailing slash it always says page not found, the page only loads correctly without the slash at the end,
eg it doesn't work : abc.com/us/ + redirects to abc.com/us/:
it does work abc.com/us
Every other subdomain in the multisite works correctly
In your .htaccess file,
Add the following .htaccess code to fix the trailing slash issue.
RedirectMatch 301 ^(.+)/$ $1
The above code will remove trailing slash (/) from the URL except the root.

Changing the Display URL Using Mod Rewrite

I need to change the display URL from
www.site.com/blog/events/
to
www.site.com/events/
I have installed WordPress in
/blog/ directory and have installed a plug-in for /events/ for dynamic event management.
Basically, I want to get rid of /blog in the URL when /events/ occurs in the URL.
I have tried various rewrite rules using .htaccess file but none of the rules worked out.
Also, there are 2 .htaccess files (the first .htaccess file is the default file found in the root path of the web server and the other is the default WordPress .htaccess file presents inside /blog/ directory).
I am little confused on which .htaccess file I need to try the URL mod rewrite rule.
How to do this using URL mod rewrite conditional rule?
Please help me to see the light. Any support would be greatly appreciated!
Thanks in advance...
Try this code in htaccess root directory :
RewriteEngine On
RewriteRule ^events/(.*)$ /blog/events/$1
The first line allows you to rewrite url. The second line check if the url begin with "events/", and if it's the case, the server is going to look files in the real "blog/events/" directorie.

Resources