Welcome! Log In Create A New Profile

Advanced

MOd_rewrite for nice URL's

Posted by kenrrik 
MOd_rewrite for nice URL's
May 11, 2007 02:17AM
Does any one have sit down and created a .htaccess file that will rewrite and format the url's nicely for search engines?

If yes, can you share? smiling smiley

TY
Re: MOd_rewrite for nice URL's
May 11, 2007 09:29PM
http://www.sphider.eu/forum/read.php?2,476,477 is even about MOD_REWRITE
Re: MOd_rewrite for nice URL's
May 12, 2007 09:41PM
Ok, is look like I will have to do this and share it the community....
Re: MOd_rewrite for nice URL's
May 12, 2007 09:49PM
Would be nice

When it goes to REG_EXP I'am really stupid ;o)
Re: MOd_rewrite for nice URL's
May 13, 2007 03:52AM
I have sit down and manage a way to do this.
This is very complicated when you have a lot of categories.

If you have time and love this here is some keypoints for you to follow. Not everyone use the same strategy but here is how i am doing for my own purpose:

On categories.html I modify my URL's to be displayed as:
- <a href="http://directory.XXXXX.com/directory/<?php print str_replace(" ","-", $_val['category'])?>/" title="<?php print $_val['category']?>"><b><?php print $_val['category']?></b></a>

Then on the .htaccess files I have rules for each category as follow:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^directory/([0-9]+)/$ directory.php?catid=$1
RewriteRule ^directory/Alpacas/$ directory/4/
RewriteRule ^directory/4$ directory/Alpacas/ [R=301]
RewriteRule ^directory/4/$ directory/Alpacas/ [R=301]
RewriteRule ^directory/Alpacas$ directory/Alpacas/ [R=301,L]

smiling smiley
Re: MOd_rewrite for nice URL's
May 13, 2007 04:01AM
kenrrik Wrote:
-------------------------------------------------------
> I have sit down and manage a way to do this.
> This is very complicated when you have a lot of
> categories.
>
> If you have time and love this here is some
> keypoints for you to follow. Not everyone use the
> same strategy but here is how i am doing for my
> own purpose:
>
> On categories.html I modify my URL's to be
> displayed as:
> - /" title="<?php print $_val['category']?>"><?php
> print $_val['category']?>
>
> Then on the .htaccess files I have rules for each
> category as follow:
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
>
> RewriteRule ^directory/([0-9]+)/$
> directory.php?catid=$1
> RewriteRule ^directory/Alpacas/$ directory/4/
> RewriteRule ^directory/4$ directory/Alpacas/
> RewriteRule ^directory/4/$ directory/Alpacas/
> RewriteRule ^directory/Alpacas$ directory/Alpacas/
>
>
> smiling smiley


Forgot to explain something on this:
The str_replace(" ","-", $_val['category']) will work if i have a category called "My Category". This will translate into "My-Category".

Then on .htaccess i have like that ^/directory/My-Category/

Just to make a point clear.
Sorry, only registered users may post in this forum.

Click here to login