having issues with mod-rewrite / .htaccess php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
codescript
Forum Newbie
Posts: 1
Joined: Thu Nov 13, 2008 4:34 pm

having issues with mod-rewrite / .htaccess php

Post by codescript »

This is my .htaccess file below

Code: Select all

 
Options +FollowSymLinks
RewriteEngine on
RewriteRule auto/id/(.*)/ auto.php?id=$1
 
Trying to re-write mywebsite.com/auto.php?id=3

to

mywebsite.com/title_of_vehicle/

need php code for mod-rewrite to translate link to mywebsite.com/title_of_vehicle/

sorry... kind of a beginner.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: having issues with mod-rewrite / .htaccess php

Post by requinix »

You're trying to rewrite URLs in the wrong direction that mod_rewrite is set up for.

Make your auto.php redirect to where you want it to go.

Code: Select all

<?php
$id = $_GET["id"];
// look up the title
header("Location: /title-of-vehicle");
exit;
Post Reply