I need to remove trailing slash from URLs ending with .xml/
only .. For this purpose I've created a Rewrite Condition and Rule which is working perfectly fine for the test link http://website.com/test.xml/
Test Link: http://htaccess.mwl.be?share=6fe08232-438a-53fa-8f1a-1f7f69b77b6f
The problem is when I place the rule in WordPress .htaccess
file, it doesn't work at all! Seems like WordPress or YOAST Permalink structure is overriding the rule .. please help!
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} /(.*).xml/$
RewriteRule ^ /%1.xml [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Note:
Please note that this is not a physical file .. using rewrite rules to generate sitemap on the run! This is a wordpress page in fact!
add_rewrite_rule('([^/]*)-placeholder.xml','index.php?page_id=123&custom-slug=$matches[1]','top');