Forum Moderators: phranque

Message Too Old, No Replies

Basic Mod Rewrite

         

edward301

3:32 pm on Oct 29, 2005 (gmt 0)

10+ Year Member



After extensively going through the last 12 pages of this sub forum, I still cant get a solution to work for me. Ive had partial success with having the acutal pages listed in the .htaccess but its always worked as a redirect instead of loading the content under the actual url i desire.

I would like the following url
[mysite.com...]

to load [mysite.com...]

I dont mind if it is a catch all i.e.

[mysite.com...] page)
Loads
[mysite.com...] page)

or

I list every page individually eg

RewriteEngine on
RewriteRule ^http://www.mysite.com/content/blue-widgets-blue/$ [mysite.com...] [L]

Thank you

jd01

6:29 pm on Oct 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem is you are using full canonical URLs -- on the left side of the rule this will not match your file. On the right side of the rule it generates a redirect (external) instead of a rewrite (internal).

RewriteRule ^content/blue-widgets-blue/$ /content/static/blue-widgets-blue.php [L]

The catch-all version would be something like:

RewriteRule ^content/([^/]+)/$ /content/static/$1.php [L]

I recommend visiting the Apache Library [webmasterworld.com] and Forum Charter [webmasterworld.com] to get a better understanding of how mod_rewrite works and what it does.

Hope this helps.

Justin