Jump to content

HEADER URL


arunpatal

Recommended Posts

I want to do somthing if i have url like domain/index.php or domain/index.php?x=value

if ($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] == $_SERVER['SERVER_NAME'] . "/index.php"){


execute some code..


}
The code above work fine but when index page changes to index.php?x=value then the code doesn't execute.....
Link to comment
Share on other sites

Sorry that i could not clear what i really want.

I want to hide index.php or anything following index.php like index.php?x=value

That it shows only domain name like mywebsite.com

If your server is setup correctly it should serve index.php by default if you go to site.com/ without specifying a file after the domain.

 

But if you're passing a query string to index.php then you cant hide it. Although you could use mod_write, eg

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$    index.php?x=$1 [L]

Will pass anything after site.com to index.php?x=whatever. For example site.com/example will actually call index.php?x=example and ofcourse $_GET['x'] will return example

Link to comment
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.