Wordpress htaccess in custom PHP -


i creating new website uses custom php code, retrieving wordpress posts remote wordpress.

in root folder (as wordpress does), have default wordpress .htaccess file:

# 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 

i have index.php file gives me posts wp:

<?php // include wp-load'er include('wp/wp-load.php');   // last 10 posts $recent_posts = wp_get_recent_posts(array(     'numberposts' => 10,     'post_status' => 'publish' ));  ... ?> 

in project have other custom php files search.php, detail.php etc.

all wordpress posts links formatted using slugs like: www.mywebsite.com/my-post/

the question is, how can change .htaccess file in order pass index.php slug parameter when url not .php file?. (like index.php?slug=my-post)

thanks.

you can try that. hope you.

rewriteengine on rewritecond %{request_uri}  ^/index\.php$ rewritecond %{query_string} ^slug=(.*)$ rewriterule ^(.*)$ http://www.mywebsite.com/page/%1.html [r=302,l]  # 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 wordpres 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -