Rewrite url problem

Discuss practical ways rearrange URLs using mod_rewrite.

Rewrite url problem

Postby webanunturi » Thu Jul 17, 2008 7:28 am

Hy,

I have this htaccess file:

php_flag display_errors on
Options +FollowSymLinks

<IfModule mod_rewrite.c>
RewriteEngine on


RewriteRule ^index.html$ index.php [L]
RewriteRule ^termeni.html$ index.php?Page=Terms [L]
RewriteRule ^contact.html$ index.php?Page=Contact [L]
RewriteRule ^despre-noi.html$ index.php?Page=AboutUs [L]

#Pagina
RewriteRule ^pagina-([^/\.]+)?.html$ index.php?Page=$1 [L]

#Category
RewriteRule ^pagina-([^/\.]+)-c([^/\.]+)?.html$ index.php?Page=$1&CategoryPID=$2 [L]

#SubCategory
RewriteRule ^pagina-([^/\.]+)-c([^/\.]+)-s([^/\.]+)?.html$ index.php?Page=$1&CategoryPID=$2&CategoryID=$3 [L]

#Object
RewriteRule ^pagina-([^/\.]+)-c([^/\.]+)-s([^/\.]+)-o([^/\.]+)?.html$ index.php?Page=$1&CategoryPID=$2&CategoryID=$3&ObjID=$4 [L]

#News
RewriteRule ^pagina-([^/\.]+)-n([^/\.]+)?.html$ index.php?Page=$1&NewsID=$2 [L]

RewriteCond %{HTTP_HOST} ^www\.(web-anunturi\.ro)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]


</IfModule>


I would like the url to look like this

name_site.ro/pagina-NAME OF THE PAGE-PRIMARY CATeg-SECONDARY CATEG-OBJECT ID.html

Can u tell me what is wrong with that htaccess?
webanunturi
 
Posts: 2
Joined: Thu Jul 17, 2008 7:23 am

Postby richardk » Thu Jul 17, 2008 1:11 pm

Explain what is wrong with the .htaccess file you have. Which rule needs changing?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby webanunturi » Thu Jul 17, 2008 1:34 pm

It dosen't change the dynamic url to a static one . Also there are no errors.

I realy don't understand why it dosent work.
webanunturi
 
Posts: 2
Joined: Thu Jul 17, 2008 7:23 am

Postby richardk » Thu Jul 17, 2008 1:36 pm

Mod_rewrite does not change how the links are outputted. You have to edit the script to make it output the new URLs.

Go to /despre-noi.html. The mod_rewrite part is working.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 38 guests

cron