I have a script that I wrote some time ago, and have just decided to "port" it into a WP plugin.
Everything works great, except for one piece of vital core functionality.
The script uses mod_rewrite to allow for virtual URLs to be used, that include a "keyword" that the script then uses later for other functions.
In particular, it allows for URLs like this:
www.domain.com/page-name/my-keyword/
it will then use "page-name" to generate the actual page content, and "my-keyword" is passed to other functions in the script for other purposes.
If WP is on default permalinks, then everything works just fine. But as soon as "pretty permalinks" are in use, my rewrite rules conflicts with the WP rules, and this feature ceases to work. WP instead generates a 404 as you would probably expect, since the requested page URL doesn't exist.
So I need a way to have custom permalinks enabled, such as /%postname%/ for example, but still be able to add information after the post name in the URL. My original script could even do this:
www.domain.com/page-name/bunch/of/stuff/can-go/in/here/and/will/be/ignored/my-keyword/
and it would still use "page-name" for the content, and "my-keyword" as the keyword, ignoring everything between. I would like this functionality with WP as well but as yet have not been able to figure out the solution.
Here's my script's original rewrite code:
RewriteBase /wp
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [S=44]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=44]
RewriteRule ^(.*)$ index.php?k=$1&%{QUERY_STRING}
And here is what WP generates by default when I set my permalinks to /%postname%/:
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
I would prefer to not require the user to do any htaccess editing, handling this instead through my plugin itself if possible. Have gotten close but not quite there.
Any ideas?
Thanks!
Jonathan