Need advice on building SEO urls
So the thing is i try to build my own webpage/cms and stuff. Everything works great, but now i want to optimize it 开发者_开发百科up a nich. And i'm going for SEO friendly urls at this time. For people who will suggest "use framework" i'll minus rep because you can't learn php just by using framework ( tho frameworks are very good and i'll move on them later ).
So the situation is as follows: I have pages like my_profile.php and index.php?deal=39 and so forth. I know i need to use mod_rewrite and i have a little expierence with it. I know that you can make use of GET params in mod_rewrite.
Also if i have url like www.example.com/index.php?id=88 how do i make those in www.example.com/very-cool-url
So generally any good advice is apriciated on how to proceed.
This should be enought for you to start with.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT]
Basically, now you can type something like
example.com/contacts/john
and make use of PHP to fetch the parameters, like
$params = explode('/', $_SERVER["REQUEST_URI"]);
Note that this code wasn't tested, and there's a LOT more to it than just this.
精彩评论