Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Beginner trying to simplify script


rocknbil - 4:42 pm on Jun 7, 2010 (gmt 0)


Yeah, probably don't need to check for > 0 now that I'm seeing it roll out. :-)

Some things here . . . .

RewriteRule ^([A-Za-z0-9]+)$ /index.php?i=$1 [L]

So this will pipe almost everything to the domain root in a query string. Some examples that will wind up as i in $_GET

/phpinfo :-) (but your script will filter it out and point it to 0.php for an include, using is_numeric())
/anyfile (0.php)
/1
/2

What WON't go to index.php,

/some-file
/some_other_file

A direct request to a domain root won't, but that will probably go to index.php by default if you don't have an index.htm(l). So again, 0.php

So I am presuming you are still only accepting requests for numeric URL's right? So you can make this more specific:

RewriteRule ^(\d+)$ /index.php?i=$1 [L]

\d and 0-9 are equivalent, and no need for a class. Just a bit of info, [A-Za-z] and either of those with a no case modifier are also equivalent:

RewriteRule ^([a-z]+)$ /index.php?i=$1 [NC,L]

Just a question, is this experimental or intended for a live site? The reason I ask is

example.com/4

Is not a real fruitful URL in terms of SEO and user experience, but

example.com/buy-cool-widgets

might be. But with what you've done so far, it wouldn't be too difficult to change tactics.


Thread source:: http://www.webmasterworld.com/php/4147806.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com