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
Related
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.
I have installed WordPress multisite in sub-directory abc.com/en/. I want to remove the trailing slash for SEO purposes. So pages like abc.com/en/xxx/ will be 301 redirected to abc.com/en/xxx without a trailing slash.
After checking many resources (I am using Nginx), I found the code below to be working for all pages except the multisite homepage abc.com/en/. WordPress always 301 redirects abc.com/en to abc.com/en/ with a trailing slash, so it will cause a redirect loop.
if (!-d $request_filename) {
rewrite ^/(.*)/$ /$1 permanent;
}
So how can I remove the trailing slash for the en/ too? Many thanks in advance!
add this line to functions.php
This this line you can fix redirect from domain.com/page to domain.com/page/ with trail slash
remove_filter('template_redirect', 'redirect_canonical');
Please don't forget clear cache or test on clean browser
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.
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.
We have magento rewrites on and are running on nginx with php-fpm. If the string "index.php" is in the url magento returns 404. e.g. http://www.mysite.com/index.php/api is a valid magento url, but it will return 404. If I drop index.php, so http://www.mysite.com/api, then it works.
How do I debug this in Magento to see why magento is saying index.php is not a valid page? Or better yet, has anyone seen this behavior and know how to fix it either in nginx or in magento?