Problem with URL with multiple variables

Discuss practical ways rearrange URLs using mod_rewrite.

Problem with URL with multiple variables

Postby sops21 » Mon Sep 22, 2008 12:18 am

I have a problem.

I have a url that goes as following.

Code: Select all

I'm using the following rule to accomplish this:

Code: Select all
RewriteRule ^testchannel/([^/\.]*)/([^/\.]*)/?$ /video/viewchannel-testing.php?curlname=$1&pagenumber=$2 [L]

This almost works.
I have one problem:

works, as well as


works, however


without the "/" at the end does not work, it 404's.

What do I need to change in the rule to make it work?
Posts: 1
Joined: Mon Sep 22, 2008 12:07 am

Postby richardk » Tue Sep 23, 2008 11:36 am

It is because there are two "/"s in the pattern (not including the /? at the end).

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^testchannel/([^/\.]+)(?:/([0-9]+))?/?$ /video/viewchannel-testing.php?curlname=$1&pagenumber=$2 [QSA,L]
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 10 guests