Mod Rewrite Help
Posted: Wed Aug 16, 2006 8:44 am
I need a rewrite statement that will take an url such as this..
domainname.com/category/name/page_1.html
and allow me to extract the category, name and page number in a file called something like domainname.com/view.php. The only catch is that there are probably going to be other rewrite statements, so the url will need to have some sort of unique identifier, possibly page?
I don't know how to write mod rewrite statements. I have some code..
Which will take http://yoursite.com/somepage/id-20/name-funny.html and allow it to be parsed by php..
But I don't want the variable name (ie id and name) to be in the url.
domainname.com/category/name/page_1.html
and allow me to extract the category, name and page number in a file called something like domainname.com/view.php. The only catch is that there are probably going to be other rewrite statements, so the url will need to have some sort of unique identifier, possibly page?
I don't know how to write mod rewrite statements. I have some code..
Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule ^somepage/(.*)\.html somepage.php?rewrite=$1 [L]Code: Select all
if( $_GET['rewrite'])
{
$request = $_GET['rewrite'];
mod_rewrite( $request, '/', '-' );
# if you have register_globals enables uncomment the following
# extract( $_GET, EXTR_OVERWRITE );
}