Re: Simpler urls
- From: Paul Furman <paul-@xxxxxxxxxxxxx>
- Date: Tue, 10 Jul 2007 17:14:05 -0700
On Jul 10, 3:56 pm, Paul Furman <p...@xxxxxxxxxxxxx> wrote:
I want to have urls that work like the php.net
pages where there's just a word after a slash,
maybe a few folders deep.
This has almost nothing to do with PHP.
OK so no considerations for my php coding? I'm passing paths every which way, that'd be great if I didn't have to update any of that.
This is a HTTP server-level
problem. Apache has a module called mod_rewrite, which can be
configured to accomplish what you want:
Right now I've got urls & code like this:
But I'd prefer:
I'd like to see at most:
If your hosting company allows .htaccess files, add these lines to
your .htaccess file in the site's root directory:
RewriteRule ^California(.*)$ /1/?SC=go.php&DIR=California$1 [NC,L]
This should do the trick.
Looks cool, from what I can tell, the only thing to learn is the syntax & rule evaluating order. Sounds like I could set up however big an htaccess file to identify my simplified structure but maybe at some point it would take a hit on performance... or not if I figure out how to tell it to stop searching the rule list. Maybe the 'index' I talked about before would become a long well-sorted rule list that I run through php after making updates to regenerate the index?
-this type I'd have to generate by choice
-this type I'd like to generate automatically, if I had a repeat named subfolder that would cripple it, but that's a rare situation. Each addition to the photo library sits under some number of folders with a name like: '2007-06-19-location' sometimes only with the date in which case the indexer would build something like 'stanyan/2007-06-19'.
This should also maintain the old navagation system, as soon as someone hits a full archive path, the url will convert to whatever shortcut overrides in the htaccess file as long as it's indexed. If it's not an indexed folder yet, it reads as is. It's possible I could create dead end folders with no links to them but not normally a problem.
Paul Furman Photography
Bay Natives Nursery
- Re: Simpler urls
- From: NC
- Re: Simpler urls
- Prev by Date: Re: Openning a HTTPS connection
- Next by Date: Re: how do professional PHP developers handle defaults for function parameters?
- Previous by thread: Re: Simpler urls
- Next by thread: Re: Simpler urls