LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 349 users online 225242 members 478 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | News | FAQ
Member Spotlight
dayvud haz paranorm
I haven't filled out my profile...
Days Active: 16
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 / 10 MPM
Christmas!
Fresh Topics
  LiveWire / Technical Forums / Computer Networking / Adding Reply

Quoting Post
Archived Topic: It will not be bumped to the top of the forum.
Topic Apache and mod_rewrite
Membername   Not a member? Sign Up Free (takes 20 seconds)
Password   Forgotten your password?
Post

Font:   Size:   Color:

FAQ Keyword Search:
Post Options
Favorites Manager
Notify me of new replies to this topic by email
Notify me of new replies to this topic by private message
Original Post
ThugAngel Posted 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

Replies
Tony327 Posted at 1:03 pm on Aug. 25, 2008
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

ThugAngel Posted at 12: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

Tony327 Posted at 12: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?

Narfle the Garthok Posted at 12:46 pm on Aug. 25, 2008
I see what your saying now.
ThugAngel Posted at 12: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.

Narfle the Garthok Posted at 12:43 pm on Aug. 25, 2008
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.

Tony327 Posted at 12:41 pm on Aug. 25, 2008
(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.)
Tony327 Posted at 12:38 pm on Aug. 25, 2008
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?
memorexdl Posted at 12:37 pm on Aug. 25, 2008
I are tarded dent esk meh
All 9 previous replies displayed.