0

I need add a rewrite rule in my WordPress plugin, and distribute it with my code. All works fine if I put the rule in the .htaccess in the WordPress root folder, but I need distribute the plugin with my rule.

I try to put a .htaccess inside the plugin folder but doesn't works.

Here the .htaccess code that works correctly in WordPress root folder but doesn't works in my plugin folder:

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteRule my-plugin/pages/tp(.*)\.php$ wp-content/plugins/my-plugin/pages/request.php?pid=$1

</IfModule>

I always get the error that the URL wasn't found. Is possible have the .htaccess in the plugin folder?

1 Answer 1

0

For archive purpose:

WP handles the plugins from the /wp-admin directory with a PHP script (admin.php), like this:

http://MyWP.com/wp-admin/admin.php?page=MyPlugin/module.php Therefore, .htaccess files in the plugin directory are not parsed when the plugin is called. They have to be placed in the wp-admin directory or in the root directory, as you already found out.

from https://stackoverflow.com/questions/14619333/add-rewrite-rule-in-plugin-with-htaccess-in-plugin-folder-or-using-wordpress-f

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .