Hi, guys.
I'm designing a wiki-type site at the moment but have run into a problem with a URL format I would like to use. Basically I would like to use colons in the URL but the server keeps throwing out a 403 (forbidden) page.
Is there a way around this using .htaccess?
An example URL would be....
www.somesite.foo/wiki/Discuss:Topic
The URL gets bounced transparently to a single template PHP file (which works fine without the colon)....
www.somesite.foo/wiki_template.php?requ ... cuss:Topic
Any ideas?
Thanks,
Si ++
Using colons in a URL
Moderator: General Moderators
Using colons in a URL
Last edited by Gen-ik on Mon Mar 20, 2006 10:41 am, edited 1 time in total.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Thanks for the quick reply.
The htaccess code I'm using is very basic at the moment:
That obviously lives in the /wiki/ directory.
The htaccess code I'm using is very basic at the moment:
Code: Select all
RewriteEngine on
RewriteBase /wiki/
RewriteRule (.*)$ /wiki_template.php?request=$1 [L,QSA]I must be having one of those "stooopid" days today.
If I put the following code in a htaccess file in the site's root directory then it all seems to work ok.
URL == /wiki/Discuss:Topic
RESULT == $_SERVER["QUERY_STRING"] = "command=Discuss&request=Topic"
URL == /wiki/Topic
RESULT == $_SERVER["QUERY_STRING"] = "request=Topic"
I can take things from there without any problems.
If I put the following code in a htaccess file in the site's root directory then it all seems to work ok.
Code: Select all
RewriteRule ^wiki/(.+):(.*) wiki_template.php?command=$1&request=$2 [L,QSA]
RewriteRule ^wiki/(.*) wiki_template.php?request=$1 [L,QSA]RESULT == $_SERVER["QUERY_STRING"] = "command=Discuss&request=Topic"
URL == /wiki/Topic
RESULT == $_SERVER["QUERY_STRING"] = "request=Topic"
I can take things from there without any problems.
This is probably a safer version...
Code: Select all
RewriteEngine on
RewriteBase /
RewriteRule ^wiki/([^:]+):(.*)$ wiki_template.php?command=$1&request=$2 [L,QSA]
RewriteRule ^wiki/(.+)$ wiki_template.php?request=$1 [L,QSA]
RewriteRule ^wiki/?$ wiki/Home [L,R]