junkystu
junkystu

Reputation: 1487

mod_rewrite reveals re written URL

I'm new to URL rewrites so I'm just getting the hang of it. The problem I have is that my rule works and pulls the correct page but after the page loads, it displays the rewritten URL instead of the trailing slashes one in the address bar.

RewriteEngine on 
RewriteBase /
RewriteRule   ^(.+)/(.+)/([0-9]+)$  ^testing.php?do=$1&see=$2&id=$3 [NC,L]

So instead of seeing http://www.example.com/walk/cars/9843928 in the address bar, I see http://www.example.com/testing.php?do=walk&see=cars&id=9843928

Hoe can I get this to work correctly and keep the trailing slashes URL in the bar?

Upvotes: 2

Views: 69

Answers (1)

anubhava
anubhava

Reputation: 785491

Target URL shouldn't start with ^.

Replace your code with this:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^([^/]+)/([^/]+)/([0-9]+)/?$ testing.php?do=$1&see=$2&id=$3 [L,QSA]

Upvotes: 2

Related Questions