LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 511 users online 221729 members 1669 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | News | FAQ
Member Spotlight
metacarPi
Favs: Johnny Depp.
Mood: Excited
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
5 online / 26 MPM
Fresh Topics
  LiveWire / Technical Forums / Computer Networking / Viewing Topic

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


Wealthy Hobo
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 | Days Active: 353
Join to learn more about ThugAngel Ontario, Canada | Straight Male | Posts: 453 | Points: 4,048
LiveWire Humor
memorexdl

Quality Control Engineer
Reply
I are tarded dent esk meh

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

12:37 pm on Aug. 25, 2008 | Joined: April 2007 | Days Active: 85
Join to learn more about memorexdl Bermuda | Straight Male | Posts: 929 | Points: 744
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 | Days Active: 360
Join to learn more about Tony327 Georgia, United States | Straight Male | Posts: 99 | Points: 3,733
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 | Days Active: 360
Join to learn more about Tony327 Georgia, United States | Straight Male | Posts: 99 | Points: 3,733
Narfle the Garthok


Professional

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 | Days Active: 93
Join to learn more about Narfle the Garthok Alaska, United States | Straight Male | Posts: 2,095 | Points: 2,658
( ThugAngel )


Wealthy Hobo
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 | Days Active: 353
Join to learn more about ThugAngel Ontario, Canada | Straight Male | Posts: 453 | Points: 4,048
Narfle the Garthok


Professional

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 | Days Active: 93
Join to learn more about Narfle the Garthok Alaska, United States | Straight Male | Posts: 2,095 | Points: 2,658
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 | Days Active: 360
Join to learn more about Tony327 Georgia, United States | Straight Male | Posts: 99 | Points: 3,733
( ThugAngel )


Wealthy Hobo
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 | Days Active: 353
Join to learn more about ThugAngel Ontario, Canada | Straight Male | Posts: 453 | Points: 4,048
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 | Days Active: 360
Join to learn more about Tony327 Georgia, United States | Straight Male | Posts: 99 | Points: 3,733
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