Web Hosting Talk







View Full Version : Help neede in MOD rewrite .. creating htaccess file


wisam74us
03-06-2006, 06:55 PM
HI .. I am trying to use MOD rewrite to replace those long file names :
http://www.website.com/default.php?cPath=538_541_1849
http://www.website.com/default.php?cPath=538_541
http://www.www.website.com/default.php?cPath=538
with those :
http://www.website.com/cate538_541_1849.html
http://www.website.com/cate538_541.html
http://www.website.com/cate538.html

would you please help me in creating the .htaccess file to do it

wildthinks
03-07-2006, 02:48 AM
For a basic example

# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
Options +FollowSymLinks
# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root folder (i.e. RewriteBase /forums)
RewriteBase /
RewriteRule ^swishmax-(.*).html index.php?object=$1 [L]


this extend all sites with beginning swishmax and give the parametes from object...
see on swish-max.de

Do you understand this?


PS: What a ****, that i need 5 posts for use bbcode.. i cant format the post sorry!

SweetAs
03-07-2006, 05:20 AM
You can use wizard at http://www.mod-rewrite-wizard.com/ or for specific issues just go to www.doriat.com

wildthinks
03-07-2006, 09:06 AM
wow seems cool...

wildthinks
03-08-2006, 09:47 AM
but dont work really on my server...

SweetAs
03-08-2006, 10:41 PM
You need to add a path to where your file are

For i.e.
The original URL: http://www.website.com/default.php?cPath=538
The rewritten URL: http://www.website.com/538.html


RewriteEngine On
RewriteRule ^([^/]*)\.html$ /home/directory/default.php?cPath=$1 [L]