/    Sign up×
Community /Pin to ProfileBookmark

Site URL Problem

Hello,

I used a .htaccess file to modifty my dynamic URL’s so that they display as folders. For example [url]http://www.mididelight.com/pages.php?c=147[/url] now means [url]http://www.mididelight.com/pages/147/50_cent[/url]

But heres the problem, because 50 cent begins with a numeric number (50) the page displays as not found. If you change the url to be /pages/147/cent then the page dispalys properly.

Does anyone know how to remedy this? Is there somekind of function I can use to fix this problem?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYOct 15.2005 — and what about the "147"? it's a numeric value as well
Copy linkTweet thisAlerts:
@ScleppelOct 15.2005 — This worked for me, (you want it to work with or without the 50_cent bit, right?)

[CODE]
RewriteRule ^pages/([0-9]+)(/[0-9A-Za-z_-]+)?/?$ /pages.php?c=$1
[/CODE]


If we could see your rules though, we could probably find the problem with what you've got.

EDIT:

Or to force both number and name
[CODE]
RewriteRule ^pages/([0-9]+)/[0-9A-Za-z_-]+/?$ /pages.php?c=$1
[/CODE]
Copy linkTweet thisAlerts:
@mididelightauthorOct 15.2005 — This is my current code:

RewriteEngine On

RewriteRule ^pages/([0-9]+)/([a-z]+) pages.php?c=$1&$2


I pull the data like this .com/pages.php?c=147&artist=50 Cent

I do a couple of string functions to lower the case and replace spaces with underscores. And then you use that code to make this:

.com/pages/147/50_cent

How can I change that to make it works, so that /50_cent will not error?
Copy linkTweet thisAlerts:
@ScleppelOct 15.2005 — [CODE]
RewriteRule ^pages/([0-9]+)/([a-z[COLOR=red]0-9_[/COLOR]]+)/?$ pages.php?c=$1&[COLOR=red]artist=[/COLOR]$2
[/CODE]

You might not need [COLOR=red]artist=[/COLOR], depending on how you are using that value.
Copy linkTweet thisAlerts:
@mididelightauthorOct 15.2005 — thats great stuff, it worked. thanks alot!
×

Success!

Help @mididelight spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...