saariko Posted March 4, 2009 Share Posted March 4, 2009 Hi, What I am trying to do is transfer a _GET value to a default page, with as little URL naming as possible. I'll explain - I have a processing php file/page that gets values from the _GET of the URL. The output is a new redirect to an alternate page. The processing function takes the value: id=XXX, and according to the id redirects to XXX. What I am trying to do is: 1. not give the file name in the original address - succesfully done that by editing .htaccess DirectoryIndex directive. 2. transfer only 1 value in the calling address. So, if I call: www.site.com/a/[VALUE] I want my processing page to read the [VALUE] How can I do that? First trying to echo the vlaue (if I will be able to do that I am ok) <?php // Get a file into an array. In this example we'll go through HTTP to get // the HTML source of a URL. foreach($_REQUEST as $key => $value){ echo $value . "<br>";//You can for mat with HTML right here too } Link to comment https://forums.phpfreaks.com/topic/147890-how-to-get-_request-_get-value-with-no-file-name/ Share on other sites More sharing options...
Yesideez Posted March 4, 2009 Share Posted March 4, 2009 As far as I'm aware you'd need to perform a mod_rewrite in the htaccess file to rewrite the URL. Link to comment https://forums.phpfreaks.com/topic/147890-how-to-get-_request-_get-value-with-no-file-name/#findComment-776188 Share on other sites More sharing options...
saariko Posted March 4, 2009 Author Share Posted March 4, 2009 Cheers for the quick reply, here are the settings I am trying on my .htaccess RewriteBase / Rewritecond %{REQUEST_URI} !(^/a/*$) [NC] RewriteRule a/([0-9]+) /a/p.php?id=$1 [L] I am trying to rewrite from: http://www.domain.com/a/VALUE to http://www.domain.com/a/p.php?id=VALUE however, it's not working. any ideas why ? appreciate your help Link to comment https://forums.phpfreaks.com/topic/147890-how-to-get-_request-_get-value-with-no-file-name/#findComment-776234 Share on other sites More sharing options...
saariko Posted March 5, 2009 Author Share Posted March 5, 2009 *** First, if anyone can move this to the MOR_REWRITE, i will appreciate it. I don't want to double post. http://www.phpfreaks.com/forums/index.php/board,50.0.html *** Ok, I am still strugling on this, here is my last conf. My .htaccess is located on my root, and with the following tries (they are accesssed, because if for instance I will rewrite to: www.cnn.com it will work) RewriteBase / RewriteRule ^a/(.*)$ a/p.php?id=$1 [R=301,L] # RewriteCond %{HTTP_HOST} ^domain.com$ [NC] # RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301] # RewriteRule ^a/([A-Za-z0-9-]+)?$ a/p.php?id=$1 [NC] Do I need to move the .htaccess to my /a/ directory? and change the rules? Link to comment https://forums.phpfreaks.com/topic/147890-how-to-get-_request-_get-value-with-no-file-name/#findComment-777107 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.