PDA

View Full Version : Forcetype / SEF URLs



rjwebgraphix
09-19-2006, 10:20 AM
Chris:

Nice article on Search Engine Friendly URLs! Getting ready to convert a site now using the method you've explained. Also seems easier than mod rewrite and I'm all for easier. :) LOL

I originally logged in to ask a question about the .htaccess, but after searching I found the information already posted.

After seeing what it's suppose to be vs what the article showed, I thought I'd post a suggestion.

On page...

http://www.websitepublisher.net/article/search_engine_friendly_urls/3

... where you talk about what is needed to add to the .htaccess file, I only see ....

ForceType application/x-httpd-php

... in the gray box. When I originally saw that, I knew there had to be more to it than that. Searched another site and found ....

<FilesMatch "^something$">
< ForceType application/x-httpd-php >
</FilesMatch>

... as an example. This made a little more sence, but is still a little confusing as I was trying to figure out what ^ and $ did functionally. Then when searching the forums I've found other examples like....

<Files article>
ForceType application/x-httpd-php
</Files>

Ok, I get it now, I think. Will find out in a bit. In the article and example though, <Files article> and </Files> are not shown, which lead to the confusion in the first place. Also another post said something about using SetHandler instead of ForceType on certain configurations.

This also leads me to ask if SetHandler will work on all of them or if it has limitations too. I'm still confused about one article I read (Not on here) is using ^ and $ as part of the filename and would still like to know what the functional purpose for that is.

Anyway... Thanks for a great article otherwise. Now to adapt my scripts with this format and we'll be set. :) LOL

Take Care,

RJ

Chris
09-19-2006, 11:01 AM
heh... actually that code is in the article... its just being rendered as bad html I imagine. Gotta change it to &lt; etc/

rjwebgraphix
09-19-2006, 11:05 AM
heh... actually that code is in the article... its just being rendered as bad html I imagine. Gotta change it to &lt; etc/

Yes, I see that looking at the source....

<div class = "code">
<Files article><br>
ForceType application/x-httpd-php <br>
</Files>
</div>

Shouldn't take ya long to fix. :)

rjwebgraphix
09-19-2006, 11:48 AM
Got a question for ya Chris. Maybe get a suggestion from you. So far, for displaying the page and displaying $PATH_INFO information, it works. Links don't work yet because I still have to code how it's going to handle the path_info. Looking for a suggestion on the best way to do that.

Background:
The site is split into 5 main control areas...

1. index.php (which is now going to be called "start") and will have index.php just refresh to the initial start page, unless you have a better idea. Index.php is nothing but code, no html. it controls all security aspects of how to handle bad urls. In the end it requires the template providing it's a valid file...

2. template.php (Has actual site layout and can be changed via url)
Example: http://mysite.com/index.php?te=templateCan use any amount of site designs using this method.

3. Left Content - Called by the template by added LC0 thru LC9. Giving up to 10 separate files to be included on the left Column.
Example: http://mysite.com/index.php?te=template&lc0=links&lc1=tuts

4. Right Content - Called by the template by adding RC0 thru RC9. Again giving up to 10 separate files to be included on the Right Side.
Example: http://mysite.com/index.php?te=template&lc0=links&lc1=tuts&rc0=testimonials&rc9=cc
Note the RC9=cc, in this case it's Credit card logos that will not appear on some pages. In those cases I can put RC9=0 and no page will be displayed.

5. Main Content - Again called by the template by adding MC0 thru MC9. Same function as the previous ones, but is displayed in the main content area. So a full url could like like...
Example: http://mysite.com/index.php?te=template&lc0=links&lc1=tuts&rc0=testimonials&rc9=cc&mc0=home&mc1=service

The issue I'm having and it's only minor at the moment is I'm trying to think of how to handle the array. Taking a look at this url and using "start" instead of index.php the path would end up like this.

http://mysite.com/start/te/template/lc0/links/lc1/tuts/rc0/testimonials/rc9/cc/mc0/home/mc1/service

Whew!!! :) LOL Which would functionally give us...

$fakeurl[0] // START file
$fakeurl[1] // TE variable
$fakeurl[2] // What TE is set to
$fakeurl[3] // LC0 variable
$fakeurl[4] // What LC0 is set to
$fakeurl[5] // LC1 variable
$fakeurl[6] // What LC1 is set to
... etc

The problem with this is TE doesn't always have to be set as a default template is in specified in the "START" file and same with the rest of the variables. The default or "HOME" configuration is specified in the file, so only need to show what is different from the "HOME" setting. So next url might just read.

http://mysite.com/start/lc0/servicelist/mc0/services
or
http://mysite.com/start.php?lc0=servicelist&mc0=services

I could have it show what would be in each possible location on the URL for every URL, but then that is one LONG LONG url for every url.

If I don't do that, I'm having an issue wrapping my head around the handling of the url when $fakeurl[1] is not always setting the template, it could be setting LC0 or even LC1.

I guess somehow I'd have to evaluate the array and find which ones come after the LC0 thru LC9 and same with RC and MC then set those variables based on what comes after. And that is what I'm at a loss for. Because they're not consistantly in the same place in the array, I'd have to somehow evaluate the array. And that is where I'm a bit lost....

Unless of course you have a better idea. :)

Chris
09-19-2006, 12:13 PM
Ya, that is a long URL. You probably should not be relying on the URL for so much. It sorta lifts up your skirt to how your backend works to all the dirty hackers out there.

Remember though too, you do not need to put variable names in the URL, just values.

If the first variable is template type you don't need /template/27/ You just need /27/ and you know it is a template because it is first.

Now for search engine optimization issues you want to maintain URL integrity where each piece of content has a distinct URL for accessing it, and only one distinct URL. I get the feeling that with your current CMS this isn't the case and one piece of content can be accessed with multiple URLs.

It may be worthwhile to consider at least a partial CMS rewrite.

rjwebgraphix
09-19-2006, 01:05 PM
Ya, that is a long URL. You probably should not be relying on the URL for so much. It sorta lifts up your skirt to how your backend works to all the dirty hackers out there.

Remember though too, you do not need to put variable names in the URL, just values.

If the first variable is template type you don't need /template/27/ You just need /27/ and you know it is a template because it is first.

Now for search engine optimization issues you want to maintain URL integrity where each piece of content has a distinct URL for accessing it, and only one distinct URL. I get the feeling that with your current CMS this isn't the case and one piece of content can be accessed with multiple URLs.

It may be worthwhile to consider at least a partial CMS rewrite.

To keep each place in the array consistant, your probably right. For actual content, distinct urls work. There are certain things that need the variation though, which is why the flexibility. A simple example is credit card logos are to be displayed on the home page and services page, but not any other page. This does give me the flexibility to display what I want, where I want. So far, with the security measures in place, the worst thing that can happen is that a user can display a section in that column on top or below others meant to be displayed in the same section. It would only be the way they see it and would have to be a valid file in the content directory. That was tolerable by me. They couldn't mess with how it displays to someone else and can't display anything outside the content directory else it goes to 404.

Hmmm. I'll have to think about this some, because even just putting the value in the url I'd still have to have 31 possible. 10 for each content area and 1 for the template.

I'll see what I can come up with. Maybe if I beat my head on the desk enough, it will come to me. :) LOL

RJ

rjwebgraphix
09-19-2006, 08:31 PM
One more quick question. (I just about have it working)

Just went to test and using different filenames for testing purposes.

Trying to figure out how to set multiple filesname in .htaccess

As example:

<Files start>
ForceType application/x-httpd-php
</Files>

is currently in .htaccess and works, but want to add faketest as another filename can I just do....

<Files start faketest>
ForceType application/x-httpd-php
</Files>

or do I need to do separate complete entries for each filename, or maybe comma separated? Can't seem to find any data on this, then again, I really didn't look very hard. Been working on this all day. Well, on and off anyway. :) LOL

Thanks,
RJ