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.

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

Answers


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]

Need Your Help

Error auto resize length of array in C

c windows process

I have a program to execute some process and show ID of them:

Excel VBA open folder and get GPS info (Exif) of each files in it

excel vba excel-vba gps

Guided by Jzz and David on another post, I discovered a VBA userform and modules that can be imported to Access DB or Excel that will ask you to select a file and it will display the EXIF external ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.