URL Rewriting

New to mod_rewrite? This is a good place to start.

URL Rewriting

Postby johneva » Mon Jun 08, 2009 12:09 pm

Hi

I could do with a little help I am trying to figure out how to do URL Rewriting I used one of them tools about but with no luck, could do with some pointers on where its wrong.

Or if this is even possiable or wether I need to adjust the PHP scripting to do what I want.

Current URL example

http://www.ors-recycle.com/used_furnitu ... =Boardroom

What I would like it to be like example

http://www.ors-recycle.com/used_furnitu ... Boardroom/

Current HTAccess file

Code: Select all
Options -Indexes

<Files ~ "^_.*\.php$">
   Order Allow,Deny
   Deny from all
</Files>


Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ors-recycle\.com$ [NC]
RewriteRule ^(.*)$ http://www.ors-recycle.com/$1 [R=301,NC]
RewriteRule used_furniture/sec/(.*)/cat/(.*)/category/(.*)/ used_furniture.php?sec=$1&cat=$2&category=$3 [R=301,L]



redirect 301 /new_canteen_tables.asp http://www.ors-recycle.com/new_furniture.php?category=Canteen+Tables&sec=cat&cat=46


Cheers
johneva
 
Posts: 1
Joined: Mon Jun 08, 2009 12:00 pm

Postby richardk » Mon Jun 08, 2009 3:40 pm

You are permanently redirecting (R=301) to a relative path which causes the URL to change and your document root to be added respectively.

Try
Code: Select all
Options +FollowSymLinks -Indexes -MultiViews

Redirect 301 /new_canteen_tables.asp http://www.ors-recycle.com/new_furniture.php?category=Canteen+Tables&sec=cat&cat=46

RewriteEngine On

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

RewriteRule ^used_furniture/sec/([^/]+)/cat/([0-9]+)/category/([^/]+)/?$ /used_furniture.php?sec=$1&cat=$2&category=$3 [QSA,L]

<Files ~ "^_.*\.php$">
   Order Allow,Deny
   Deny from all
</Files>
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 102 guests

cron