homepage Welcome to WebmasterWorld Guest from 54.227.215.139
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Query strings and mod_rewrite...
nospecialfx

10+ Year Member



 
Msg#: 883 posted 2:05 am on Jan 17, 2004 (gmt 0)

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

 

nospecialfx

10+ Year Member



 
Msg#: 883 posted 2:09 am on Jan 17, 2004 (gmt 0)

btw, my PHP script looks like this...

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

jdMorgan

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



 
Msg#: 883 posted 2:13 am on Jan 17, 2004 (gmt 0)

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

nospecialfx

10+ Year Member



 
Msg#: 883 posted 2:25 am on Jan 17, 2004 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved