LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-09-2013, 09:09 PM   #1
Ranjith KR
LQ Newbie
 
Registered: Sep 2012
Posts: 7

Rep: Reputation: Disabled
Nginx rewrite rule for url like www.domain.com/something.php?asd=327154723448


Hi,

I am trying to write a rewrite rule in nginx.

I need to redirect the url like, www.domain.com/something.php?asd=327154723448

to

www.domain.com

I tried rewrite ^/something.php?asd=327154723448 http://www.domain.com last;

But it shows the 404 page.

I also tried with

rewrite ^/something.* http://www.domain.com last;

but that throws the last part of the url (?asd=327154723448 ) with the redirecting url like www.domain.com?asd327154723448

Any idea ?

Thanks in advance.
 
Old 03-10-2013, 04:11 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You need to add a "?" at the end of the replacement URI:
Code:
rewrite ^/something.php(.*)$ /? last;
Regards
 
Old 03-10-2013, 09:38 PM   #3
Ranjith KR
LQ Newbie
 
Registered: Sep 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Hi bathory,

Thanks for the reply.


That worked for me.

Thanks a lot.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
nginx rewrite url ubungu Linux - Newbie 1 07-19-2012 07:51 AM
Problem with dynamic url rewrite and redirect in nginx??? gavin2u Linux - Server 3 05-27-2010 10:25 PM
nginx 0.7.65 rewrite url with querystring problem? gavin2u Linux - Server 0 04-07-2010 07:46 PM
rewrite rule for url change ravibhure Linux - Server 2 01-21-2010 09:12 PM
URL rewrite rule not working... vikram_cvk Linux - Software 1 12-03-2008 02:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration