Search code examples
wordpressapache.htaccessmod-rewritepermalinks

Wordpress: Create static permalink in htaccess


I want to put a static permalink in the .htaccess file. For example when I go to the http://www.example-page.com/testsite the server redirect to this http://www.example-page.com/wp-admin/example.php?test=data

My problem is that I didn't want to destroy the permalink structure of the WordPress blog.

My .htaccess file code looks like as follows:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Thanks for your help.


Solution

  • Add this rule after RewriteBase /

    RewriteRule ^testsite$ /wp-admin/example.php?test=data [R=301,L]
    

    It will intercept only the specified URI and redirect it. Other WP's permalinks should work as usual.