0

My custom .htaccess commands are above the WP ones. This is working:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ wp-content/ahoj.txt [N]
</IfModule>

It shows the contents of my file ahoj.txt at the root of example.com

While this isn't working:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ language/ [N]
</IfModule>

As language/ is not a real directory, but a permalink set by wp (wpml). How do I make the contents of example.com/language visible at example.com without changing the URL?

2
  • You need to do this in WordPress, not .htaccess. When you internally rewrite the request (in htaccess), WP still "sees" the URL that was requested (ie. the root), not the URL that is rewritten to (ie. /language). And you should be using the L flag, not N! (No need to repeat the <IfModule> and RewriteEngine directives.)
    – MrWhite
    Commented Oct 16, 2020 at 15:19
  • in WordPress means with add_rewrite_rule() ? I couldn't get that work either...
    – Fanky
    Commented Oct 16, 2020 at 15:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.