Search Engine Friendly URLS


(Public Garbage) #1

[color=“navy”]Hey guys,


I’m aware of few techniques to handle search engine friendly urls, including using PATH_INFO, mod_rewrite and the ErrorDocument and ForceType directives. However, I I know the matrix install did not modify my httpd.conf and I can’t see any .htaccess files in the matrix hierarchy.



Considering this, could someone shed some light on me with how matrix manages to bypass apache, parse the url, and (try to) map the request to an asset? I mean, the parsing+mapping stuff is ok, but bypassing apache… I must be missing something here!



Cheers!



S.


(Avi Miller) #2

Matrix requires either manual modification to httpd.conf (to add Alias lines) or the web installer creates a series of symbolic links and an .htaccess file in the web root.


(Public Garbage) #3

[color=“navy”]Yup, that I understand (I added the 4 Aliases in httpd.conf at install), but let’s take an example;


. I can currently access http: // localhost/sample_site/sampe_home,

. As there are no such hierarchy in the file system, apache should return a 404 error, unless it was instructed to act differently (widh directives) in httpd.conf or in a .htaccess file,

. the / directory (or translated matric_root/core/web/) does not contain .htaccess file,

. the 3 other aliases (those begining with ) are not being ‘triggered’ at this time as the url is not something like http: // localhost/*,



To my understanding, there as to be somewhere that apache needs to be told how to handle 404 or default document - or, the ‘url hierarchy’ needs to be replicated into a ‘folder hierarchy’…



mmm… yeah… well… looking at the core code… I wish as was as smart as you guys!! :wink: I’ve been fooling around for hours now and I’m still pretty damn impressed!!



So anyways… can you see what I’m missing for the friendly urls thing?



Cheers!



S.


(Avi Miller) #4

The line:


Alias "/" /path/to/matrix/core/web/index.php/



Is the kicker. It passes the full path info INTO index.php, so that we can work with it.


(Public Garbage) #5

[color=“navy”]
Ooooooh now I see! now THAT explains a lot! it defines index.php as being the default document for every subfolders!



I just love that!!

Keeps getting better!



Have a great weekend guys! and thx for that Avi!



Cheers!



S.





edit:

… though I should’ve thought about it…! :stuck_out_tongue: