.htaccess rewriting



I know this has been brought up in previous posts, but I did think I
understood the basic principals of rewriterule etc until I tried it...

my understanding was/is

RewriteEngine On // Turns on the rewriting option
RewriteBase /test/ // sets the directory for rewriting so rewriting only
happens within the lower directories of /test/
RewriteRule A B // find regex A and replaces it with B

is this correct ?

I am trying to replace part of my url as follows...

http://www.mydomain.co.uk/test/?p=article&id=1

replace "?p=" with "" (nothing)
replace "&id=" with "/"
to create a static looking url

http://www.mydomain.co.uk/test/article/1

my .htaccess file looks like...

RewriteEngine On
RewriteBase /test/
RewriteRule ^(\?p=)$ ^$

this excludes the &id= part as I thought I would deal with the ?p= first

Questions.
Should the .htaccess file be in the root or in /test/ or both?
Are my assumptions correct about the behaviour of the 3 commands?
Why isn't it working?

I have looked at http://httpd.apache.org/docs-2.1/mod/mod_rewrite.html but
it is hard getting those details into my thick head !!

Alex


--
----------------------------------------------------------------------------
http://www.clickonlingerie.com?SIG - Exotic Erotic Lingerie
----------------------------------------------------------------------------



.



Relevant Pages

  • Need Help to prevent external linking
    ... I've researched the following to put in an .htaccess file on teh root of my ... RewriteRule .*\.jpeg$ - ... that is all I have in teh .htaccess file that sits at the root of my server, ... the warning image does not display - the file that was ...
    (comp.lang.php)
  • Re: PHP include and changing page names
    ... .htaccess file. ... Using the above RewriteRule I did a test. ... Or is it at the server configuration level (which I do not have ... You could try to use RedirectMatch in your .htaccess: ...
    (alt.html)
  • Rewrite Rules under linux (Specifically Centos 5): Newbie
    ... I have set up a set of re-write rules in my HTACCESS file so that ... I just want to catch every and any extension ... RewriteRule sitemap.xml /sitemaphandler.php ...
    (comp.os.linux.misc)
  • Re: PHP include and changing page names
    ... I do have the ability to edit the ... .htaccess file. ... Using the above RewriteRule I did a test. ... Or is it at the server configuration level (which I do not have ...
    (alt.html)
  • Re: PHP include and changing page names
    ... .htaccess file. ... Using the above RewriteRule I did a test. ... I left the .html error pages on the server but I got the server's default 404 page instead of mine. ... I get a 404 error but it isn't MY custom error page. ...
    (alt.html)