Forum Moderators: phranque

Message Too Old, No Replies

Help with this rewrite

         

mikemcs

8:10 pm on Feb 10, 2004 (gmt 0)

10+ Year Member



I need to show this URL:
www.****.com/CCS/Articles/Articles.php?article=1
As:
www.****.com/CCS/Articles/1/1.php

Im not really sure If I am even asking this correctly. What I am after Is I want goolge to see the Directory url but I want in php code to look up the data for article 1 from a table and display it using a standard php file I wrote called atricles.php. So I think I may need to list the URL as the second example but treat it like the first but I am not sure?

jdMorgan

1:05 am on Feb 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mikemcs,

As stated in our charter [webmasterworld.com], we're not set up to provide a code-writing service here, but we'll be glad to help you get your own code working. The following links to resources and recent threads (and the links cited therein) may be helpful:

Introduction to mod_rewrite [webmasterworld.com]
[webmasterworld.com...]

Jim

mikemcs

12:26 pm on Feb 11, 2004 (gmt 0)

10+ Year Member



Ok I have this

RewriteRule ^Articles/(.*)\.php$ Articles/Articles.php?article=$1 [R=301,L]

but it does not seem to rewrite:
www.sitename.com/CCS/Articles/1.php
to:
www.sitename.com/CCS/Articles/Articles.php?article=1

and do I need the [R=301,L] at the end?

twist

1:31 am on Feb 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I need to show this URL:
www.****.com/CCS/Articles/Articles.php?article=1
As:
www.****.com/CCS/Articles/1/1.php

Give this a try. In your .htaccess file,

RewriteEngine on
RewriteRule ^ccs/articles/1/([0-9]+)$ /CCS/Articles/Articles.php?article=$1 [L]

Now try calling it by

www.example.com/ccs/articles/1

You can make return the upper case and .php if your want.