LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 723 users online 186625 members 2137 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Video | Dictionary | News | FAQ
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
4 online / 60 MPM
Fresh Topics
  LiveWire / Technical Forums / Computer Networking / Viewing Topic

Apache and mod_rewrite
Replies: 9Last Post Aug. 25 1:03pm by Tony327
Welcome to LiveWire!
We're Stronger Together.
Join the Community
Single page for this topic Email Print Favorite
( ThugAngel )


Professional
Reply
So I wrote the following in a .htaccess file:
Code:

RewriteEngine on
RewriteRule ^games$ http://%{SERVER_NAME}/index.php?category=games [R]

The problem is that the address in the browser is replaced with 'http://localhost/index.php?category=games', when I want it to remain http://localhost/games/

Does anyone know how I can do this?

Thanks

Post edited at 12:32 pm on Aug. 25, 2008 by ThugAngel

-------
a coward dies a thousand deaths...a solider dies but once.


12:30 pm on Aug. 25, 2008 | Joined Mar. 2008 | 161 Days Active
Join to learn more about ThugAngel Ontario, Canada | Straight Male | 377 Posts | 2045 Points
memorexdl

Advisor
Reply
I are tarded dent esk meh

-------
No. You have Failed.

12:37 pm on Aug. 25, 2008 | Joined April 2007 | 79 Days Active
Join to learn more about memorexdl Bermuda | Straight Male | 930 Posts | 686 Points
Tony327


Dairy Product Addict
Reply
I believe by having the http:// in the rewrite rule, that forces an address change. Try taking that off (and even the server name variable), and see if that works?

12:38 pm on Aug. 25, 2008 | Joined May 2008 | 169 Days Active
Join to learn more about Tony327 Georgia, United States | Straight Male | 96 Posts | 1820 Points
Tony327


Dairy Product Addict
Reply
(I've done work with htaccess and mod_rewrite on my own before, and have never had to have http://%{SERVER_NAME} in my rewrite rules to accomplish what I wanted to accomplish.)

12:41 pm on Aug. 25, 2008 | Joined May 2008 | 169 Days Active
Join to learn more about Tony327 Georgia, United States | Straight Male | 96 Posts | 1820 Points
Narfle the Garthok

Dairy Product Addict

Patron
Reply
Quote: from ThugAngel at 12:30 pm on Aug. 25, 2008

So I wrote the following in a .htaccess file:
Code:

RewriteEngine on
RewriteRule ^games$ http://%{SERVER_NAME}/index.php?category=games [R]

The problem is that the address in the browser is replaced with 'http://localhost/index.php?category=games', when I want it to remain http://localhost/games/

Does anyone know how I can do this?

Thanks


Code:
RewriteRule ^games$ http://%{SERVER_NAME}/index.php?category=games

you are telling it to point to
http://localhost/index.php?category=games

http://www.ecauldron.com/web/design020.php

Read that it will help you understand where you went wrong.

-------
YOU MUST
NARFLE THE GARTHOK!

Robdude is my LW Wife.


12:43 pm on Aug. 25, 2008 | Joined June 2008 | 93 Days Active
Join to learn more about Narfle the Garthok Alaska, United States | Straight Male | 2101 Posts | 1764 Points
( ThugAngel )


Professional
Reply
If I don't put the http://%{REMOTE_HOST}/ I this error

http://localhost/C:/http/index.php?category=games

C:/http/ being where the server is. Also, my rewrite works, but I don't want the browser address to change.

-------
a coward dies a thousand deaths...a solider dies but once.


12:46 pm on Aug. 25, 2008 | Joined Mar. 2008 | 161 Days Active
Join to learn more about ThugAngel Ontario, Canada | Straight Male | 377 Posts | 2045 Points
Narfle the Garthok

Dairy Product Addict

Patron
Reply
I see what your saying now.

Post edited at 12:47 pm on Aug. 25, 2008 by Narfle the Garthok

-------
YOU MUST
NARFLE THE GARTHOK!

Robdude is my LW Wife.


12:46 pm on Aug. 25, 2008 | Joined June 2008 | 93 Days Active
Join to learn more about Narfle the Garthok Alaska, United States | Straight Male | 2101 Posts | 1764 Points
Tony327


Dairy Product Addict
Reply
Quote: from ThugAngel at 3:46 pm on Aug. 25, 2008

If I don't put the http://%{REMOTE_HOST}/ I this error

http://localhost/C:/http/index.php?category=games

C:/http/ being where the server is. Also, my rewrite works, but I don't want the browser address to change.


This might not be relevant, but, why do you have the [R] flag? Have you tried taking it off, and seeing what that does?


12:55 pm on Aug. 25, 2008 | Joined May 2008 | 169 Days Active
Join to learn more about Tony327 Georgia, United States | Straight Male | 96 Posts | 1820 Points
( ThugAngel )


Professional
Reply
Quote: from Tony327 at 3:55 pm on Aug. 25, 2008

Quote: from ThugAngel at 3:46 pm on Aug. 25, 2008

If I don't put the http://%{REMOTE_HOST}/ I this error  

 http://localhost/C:/http/index.php?category=games  

 C:/http/ being where the server is. Also, my rewrite works, but I don't want the browser address to change.


This might not be relevant, but, why do you have the [R] flag? Have you tried taking it off, and seeing what that does?



LOL that worked!! thanks! also when removing that I didn't need to specify the whole server.

Code:

RewriteEngine on
RewriteRule ^games index.php?category=games


-------
a coward dies a thousand deaths...a solider dies but once.


12:58 pm on Aug. 25, 2008 | Joined Mar. 2008 | 161 Days Active
Join to learn more about ThugAngel Ontario, Canada | Straight Male | 377 Posts | 2045 Points
Tony327


Dairy Product Addict
Reply
Quote: from ThugAngel at 3:58 pm on Aug. 25, 2008

Quote: from Tony327 at 3:55 pm on Aug. 25, 2008

Quote: from ThugAngel at 3:46 pm on Aug. 25, 2008

If I don't put the http://%{REMOTE_HOST}/ I this error

  http://localhost/C:/http/index.php?category=games

  C:/http/ being where the server is. Also, my rewrite works, but I don't want the browser address to change.


 

 This might not be relevant, but, why do you have the [R] flag? Have you tried taking it off, and seeing what that does?


 
LOL that worked!! thanks! also when removing that I didn't need to specify the whole server.

Code:

RewriteEngine on
RewriteRule ^games index.php?category=games


I'm glad it worked


1:03 pm on Aug. 25, 2008 | Joined May 2008 | 169 Days Active
Join to learn more about Tony327 Georgia, United States | Straight Male | 96 Posts | 1820 Points
Single page for this topic Email Print Favorite

Quick Reply

You are signed in as our guest.

Looking for something else?
 

  LiveWire / Technical Forums / Computer Networking / Viewing Topic