473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Getting URL parameters after URL rewriting

194 100+
Hi everyone,

I have problem while getting the parameters from the URL after some URL rewriting.

This is my original URL:

http://www.mysite.com/index.php?page=article-details&id=1

I am using the following code in my .htaccess file:
Expand|Select|Wrap|Line Numbers
  1. RewriteRule    ^articles/([A-Za-z0-9-]+)/?$    index.php?page=article-details&id=$2    [NC,L]    # Process articles requests
After the above rule my URL becomes:

http://www.mysite.com/articles/1

Now in this page im using $_REQUEST['id'] to get the id of the article but im not able to get any value. Please tell me how i can solve this problem.

Thank you.

Regards

Faisal
Oct 3 '10 #1
2 2239
Atli
5,058 Expert 4TB
Why do you use id=$2 in the target of your RewriteRule? I only see one capture group in your regular expression.

Try replacing it with id=$1.
Oct 3 '10 #2
mfaisalwarraich
194 100+
man it worked. thank you :))
Oct 3 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Geoff Soper | last post by:
I'm not quite sure if the answer to my question lies in the Apache or PHP realm. If I have a php script running on Apache which outputs a JPEG image such as...
1
by: Codex | last post by:
I am using Visual Studio 2003. When an exception trown (and trapped by a try statement) in a managed language (say, C#), I'd like to get the values sent to all the parameters in the stack trace. ...
3
by: Matt | last post by:
Hello, I am pretty rusty with javascript and I am trying to make a webpage that will basically act as a wrapper from one webpage to another. What I mean by this is that I will hit this page...
2
by: Eddie | last post by:
Hi All, How may I get parameters of a Link in ASP.NET ? Ex : http://localhost/test.aspx$param1=99 In the Page_Load event, I want to be able to get the value of the parameter param1 (99) Thx...
1
by: Anthony | last post by:
Hi all, I have succefully implemented url rewriting into my application using the instructions from here, http://www.codeproject.com/aspnet/URLRewriter.asp All is well except i would like...
3
by: Michael Appelmans | last post by:
I'm trying to use a rule based URL rewrite application which uses HttpApplication.RewritePath. I keep getting "rsource not found" error in application when running on shared web host although the...
2
by: craigkenisston | last post by:
Hi, I have a web user control that displays "items" by user, by category, newest "items", etc. It works very well and does what I want, this is done with parameters in the page that holds the...
7
by: Aaron Gray | last post by:
I put together the following code to get the href's parameters :- function GetParameters() { var arg = new Object(); var href = document.location.href; if ( href.indexOf( "?") != -1) { var...
3
by: Greg Collins [Microsoft MVP] | last post by:
I have done a bit of research of Url Rewriting, but as yet have been unsuccessful at getting it to work well, and there are issues around what file types are supported and how much code you want to...
0
by: FutureShock | last post by:
Newsgroups wrote: Your best bet would probably be to pass the function an array of your variables and then extract them inside the function for use. Remember that you have to pass the same...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.