Troubles Overwritting WordPress Url Rewrites

so essentially right now I have a plugin enabled to allow me to use php in my pages. I’ve setup a page and set the permalink as the homepage. Doing this I’m able to make requests like

http://mysite.com/?profile=Rihanna

and the php code will execute based on the given artist.

Read More

The issue appears when I try to make this url more seo friendly, I add the following rewrite rule to my .htaccess

RewriteRule ^artist/(.*).html http://mysite.com/?profile=$1

thinking that it should work but it does not, it simply goes to the wordpress 404 page. Now if I redirect it to a regular html file instead of mysite.com/?profile=$1 it works just fine.

Does anyone have any idea what’s wrong and how I can get it working properly?

Thanks

Related posts

Leave a Reply

1 comment

  1. Make sure your rule is before all of your wordpress rules. WordPress’ rules route all requests through am index.php and since “artist” is probably a bad permalink, it’ll return a 404.

    Additionally, if you include the http://mysite.com in your rule’s target, it will inherently redirect the browser as opposed to internally rewriting the URI. You should remove it and include an [L] flag so rewriting stops in the current iteration (thus the wordpress rules won’t get applied):

    RewriteRule ^artist/(.*).html /?profile=$1 [L]