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 } Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.