LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 08-15-2010, 11:25 PM   #1
repolona
LQ Newbie
 
Registered: Nov 2004
Posts: 12

Rep: Reputation: 0
Smile Rewriterule for --> http://myweb.com/user.php?uid=1 to http://myweb.com/1


Hi,

Just want to ask help regarding apache rewriterule.

Need to rewrite this site URL:
--> http://myweb.com/user.php?uid=1

TO this new site URL:
--> http://myweb.com/1
and is also accessible from
--> http://myweb.com/1/


Thanks :-)
 
Old 08-16-2010, 01:19 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,969

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Hi,

You can try this:
Code:
RewriteEngine on

RewriteCond %{QUERY_STRING} ^uid=(.*)$
RewriteRule ^user.php(.*)$ http://localhost/%1/?
 
Old 08-16-2010, 02:22 AM   #3
repolona
LQ Newbie
 
Registered: Nov 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you very much Bathory,

we made some changes again, hope you can help me again..
instead of the previous site URL.

We are putting a new variable in post. so it will look like this.
Site URL:
--> http://myweb.com/user.php?uid=1&bookid=1

It should point to this new site URL:
--> http://myweb.com/1/ (the bookid variable is automatic 0 since its not stated)
and is also accessible from
--> http://myweb.com/1 (the bookid variable is automatic 0 since its not stated)


your help is very much appreciated.. thank you again
 
Old 08-16-2010, 03:59 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,969

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
The following should work:
Code:
RewriteEngine on

RewriteCond %{QUERY_STRING} ^uid=(.*)
RewriteRule (.*) %1
RewriteRule ([0-9]+)&bookid=[0-9] http://myweb.com/$1/? [L]
 
  


Reply

Tags
rewriterule


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
apache: http://localhost (work) http://ipaddress (not working) sarmad Linux - Newbie 7 02-05-2013 08:47 AM
Apache: Change http://localhost to http://www.mywebsite.com mlandvo Linux - Server 1 08-12-2010 09:47 AM
[SOLVED] Adding package sources fails saying "http://http not found skykooler Ubuntu 2 07-02-2010 10:32 AM
monodoc-http gives a http 500 internal server error ernesto_cgf Linux - Software 0 05-10-2007 04:48 PM
apache http://localhost/mysite ---> http://localhost/mysite/index.php how? ilnli Linux - General 8 06-04-2005 04:23 PM


All times are GMT -5. The time now is 06:41 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration