Jump to content

Recommended Posts

i need some help with mod_rewrite. check this out:

 

# CREATE REWRITE OPTIONS
Options +FollowSymLinks

# TURN THE REWRITE ENGINE ON
RewriteEngine on

# WRITE PARAMETERS TO THE INDEX URL UNLESS REQUESTED URL IS A DIRECTORY OR FILE.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule page/(.*) index.php?$1
RewriteRule ^add/([^/\.]+)/?$ index.php?add=$1 [L]
RewriteRule ^edit/([^/\.]+)/?$ index.php?edit=$1 [L]

 

 

edit/edit_character.php

$sql162 = mysql_query("SELECT * FROM players WHERE id = '{$_GET['id']}'");

 

right now the url is:

http://site.com/edit/character&id=1

the original is http://site.com/?edit=character&id=1

what i want is http://site.com/edit/character/1

The requested URL /edit/character/2 was not found on this server.

The requested URL /edit/character/id/2 was not found on this server.

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/138619-mod_rewrite-and-_get/
Share on other sites

Try this, substitute 'index' and 'index.php' for the file that is calling the id

 

Options +FollowSymLinks

RewriteEngine on

RewriteRule index/edit/(.*)/id/(.*)/ index.php?edit=$1&id=$2

RewriteRule index/edit/(.*)/id/(.*) index.php?edit=$1&id=$2

Link to comment
https://forums.phpfreaks.com/topic/138619-mod_rewrite-and-_get/#findComment-729222
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.