Welcome to WebmasterWorld Guest from 54.166.117.130

Forum Moderators: Ocean10000 & incrediBILL & phranque

Query strings and mod_rewrite...

   
2:05 am on Jan 17, 2004 (gmt 0)

10+ Year Member



I use PHP includes to pull content into my site's design container.

So, I have URL's that look like this:

mysite.com/index.php?go=/archives/001.html

That I'd like to rewrite to

mysite.com/columns/archives/001.html

So, I tried this...

RewriteCond %{QUERY_STRING} ^go=$
RewriteRule ^index\.php$ /columns/%1/ [L]

but I don't think I'm even close... any help?

Justin

2:09 am on Jan 17, 2004 (gmt 0)

10+ Year Member



btw, my PHP script looks like this...

if (isset($go)) {
include("$go");
} else {
include("mcolumnlist.html");
}

2:13 am on Jan 17, 2004 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Justis,

Welcome to WebmasterWorld [webmasterworld.com]!

I think you're real close!


RewriteCond %{QUERY_STRING} ^go[b]=/(.*)[/b]$
RewriteRule ^index\.php$ /column[b]s/%1?[/b] [L]

The trailing question mark of the rewrite substitution string clears the existing query-string. You may not need it. Also, the rewrite code may need to be preceded with

Options +FollowSymLinks
RewriteEngine on

if you don't already have that in your .htaccess file

Jim

2:25 am on Jan 17, 2004 (gmt 0)

10+ Year Member



Okay... this is now in my .htaccess file

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{QUERY_STRING} ^go=/(.*)$
RewriteRule ^index\.php$ /columns/%1? [L]

But when I goto, say

mysite.com/columns/archives/001.html

where archives/001.html is the content of the string, but I'm getting a 404 error...

Any more thoughts? I'm also in a subdomain...don't know if that matters or not.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month