Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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 http://stackoverflow.com/questions/14619333/add-rewrite-rule-in-plugin-with-htaccess-in-plugin-folder-or-using-wordpress-f

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.