Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Curbow 5 on June 15, 2004, 09:33:04 AM

Title: Queryless URL's - how do they work?
Post by: Curbow 5 on June 15, 2004, 09:33:04 AM
Common sense dictates they should use Apache's mod_rewrite. I found all the querystring rewriting stuff in Querystring.php, but I can't seem to find any reference to a .htaccess file or the RewriteEngine anywhere...

How does this work in SMF? ???
Title: Re: Queryless URL's - how do they work?
Post by: Skoen on June 15, 2004, 10:02:44 AM
You can set urls to be queryless in your admin panel -> in the Mod Settings -> just below the Moderator log setting. Activate it, hit Save and the forum should have queryless urls.
Title: Re: Queryless URL's - how do they work?
Post by: Curbow 5 on June 15, 2004, 11:08:31 AM
LOL I'm sorry, I must've not been clear. I know how to activate the queryless URL's; I was asking how they work technically: what happens codewise when I hit that checkbox and save.

Thanks for helping though!  ;)
Title: Re: Queryless URL's - how do they work?
Post by: [Unknown] on June 15, 2004, 02:28:19 PM
Apache, in most configurations, will send:

index.php/some/stuff

To index.php.

-[Unknown]
Title: Re: Queryless URL's - how do they work?
Post by: Curbow 5 on June 15, 2004, 02:34:26 PM
i see... so there's no .htaccess with rewriting rules?
also, which configuration specifically is needed?

thanks!
Title: Re: Queryless URL's - how do they work?
Post by: [Unknown] on June 15, 2004, 02:36:37 PM
In Apache 2, AcceptPathInfo....

-[Unknown]
Title: Re: Queryless URL's - how do they work?
Post by: Curbow 5 on June 15, 2004, 04:04:08 PM
and for Apache/1.3.29? ::)
Title: Re: Queryless URL's - how do they work?
Post by: [Unknown] on June 15, 2004, 04:43:55 PM
There is no setting for Apache 1...... it should just work, as long as it's compiled normally.

-[Unknown]
Title: Re: Queryless URL's - how do they work?
Post by: Curbow 5 on June 16, 2004, 03:29:31 AM
thanks [Unknown] !!! I learned stuff once again! :)
Title: Re: Queryless URL's - how do they work?
Post by: Anguz on June 16, 2004, 05:20:09 AM
I first learned about Apache's PATH_INFO when I read this article at SitePoint

Search Engine-Friendly URLs (http://www.sitepoint.com/article/485)

check out Method 1
Title: Re: Queryless URL's - how do they work?
Post by: Skoen on June 16, 2004, 06:57:03 AM
Wow what a hint... sorry my sarcasm, but that link didn't work very well, all I saw was the number... "1" on the site.
Title: Re: Queryless URL's - how do they work?
Post by: Bartrainer on June 16, 2004, 07:32:32 AM
The link works fine, interesting article. I never knew that search engines didn't index url's with"?" in them. Very good to keep in mind.

YUK
Title: Re: Queryless URL's - how do they work?
Post by: Curbow 5 on June 16, 2004, 12:49:55 PM
My host runs Apache 2.0 Filter with AcceptPathInfo set to off. I uploaded a .htaccess with the following content:

<Files "index.php">
AcceptPathInfo On
</Files>


The path_info stuff seems to work now, except that it no longer seems to load my stylesheet.... Compare http://www.jubile.nl/index.php/path_info/stuff to http://www.jubile.nl/index.php

Do I need to add something else to the .htaccess?
Title: Re: Queryless URL's - how do they work?
Post by: Anguz on June 16, 2004, 03:33:14 PM
I think that's because the browser is looking for your CSS relative to
http://www.jubile.nl/index.php/path_info/stuff/
it's trying to find it here
http://www.jubile.nl/index.php/path_info/css/classes.css

change this

<link rel="stylesheet" href="css/html.css" type="text/css" />
<link rel="stylesheet" href="css/classes.css" type="text/css" />


to this

<link rel="stylesheet" href="/css/html.css" type="text/css" />
<link rel="stylesheet" href="/css/classes.css" type="text/css" />


the same will be true for any other link that's relative to the one calling it, including internal anchors that don't specify the file since they're anchored to the same file, like

<a href="#anchor">I'm an anchor</a>

using your example URL, it should be written like this

<a href="/index.php#anchor">I'm an anchor</a>
Title: Re: Queryless URL's - how do they work?
Post by: Skoen on June 16, 2004, 04:04:18 PM
Weird, cause it seems like Google indexes some of the topics on my board.
Title: Re: Queryless URL's - how do they work?
Post by: Curbow 5 on June 16, 2004, 05:06:59 PM
Quote from: Anguz on June 16, 2004, 03:33:14 PM
I think that's because the browser is looking for your CSS relative to
http://www.jubile.nl/index.php/path_info/stuff/
it's trying to find it here
http://www.jubile.nl/index.php/path_info/css/classes.css

i kinda figured that would fix it, but i was hoping i did something wrong in the .htaccess, so I wouldn't have to change all my paths...  :-\
Title: Re: Queryless URL's - how do they work?
Post by: Curbow 5 on June 17, 2004, 01:04:38 AM
any apache2 guru's around to settle this? :)