+ Reply to Thread
Results 1 to 2 of 2

Thread: [php]Want to know how to creat address like example.com/anything

  1. #1
    neha.u1179 is offline x10Hosting Member neha.u1179 is an unknown quantity at this point
    Join Date
    Aug 2010
    Posts
    6

    [php]Want to know how to creat address like example.com/anything

    HI,
    i Want a php code that creat address like example.com/anyname . i know that this address will lookup in anyname derectory in example.com domain . but even there is no directory(anyname) than how can i assign this address to a perticular page.

    {like wordpress parmalinks }

  2. #2
    lostcommander's Avatar
    lostcommander is offline x10Hosting Member lostcommander is an unknown quantity at this point
    Join Date
    Apr 2009
    Location
    United States of America
    Posts
    52

    Re: [php]Want to know how to creat address like example.com/anything

    I am sorry if your first language is not English, but I would recommend that you use a word processor (MS-Word, Open Office - Writer, Google Docs) to create any technical posts you want to put on the internet, including help forums. The grammar, spelling, and wording can be tricky with the meaning of the sentence changing quickly with an error, and a word processor can help with the first two (grammar and spelling).

    I think that what you are asking is:
    How do I place a file on my example.com webserver at www\directory\page.php and access this file on the web using http://www.example.com/page.php ?
    If this is not what you are asking, then perhaps someone else on this board can interpret your question differently, or you could try re-writing it.

    In answer to the question I think you are asking, there are a few ways to do that PHP and/or Apache's .htaccess files:
    1 (PHP) Write an index.php or redirect.php file, send it a $_GET or $_POST variable like "page=filename", and use a switch statement and header("Location...") to redirect the user to the page you want them to be viewing. This does actually change the URL they see in the address bar and presumes you can use a switch statement and the filename to parse out which directory they should be directed to.
    2 (database+PHP) Similar to #1, but use a database table to define and track permalink names and their target files.
    3 (.htaccess) Write a .htaccess file that instructs the server to use a file from a location other than the one requested by the web browser. This method can be used to leave the user's requested URL unaltered while still giving them different content.
    4+ () There are more ways to do this if these 3 are not sufficient. Good luck.

    You might find this htaccess generator helpful, or at least a good place to start seeing what is going on. http://www.htaccessredirect.net/index.php

    Edit: P.S. Wordpress permalinks simply look up content from the database based on the "post_name" or "post_id" field from the "posts" table, and then generate the page with PHP based on the database information. The URL is crafted using .htaccess to hide the assembly page(s).
    Last edited by lostcommander; 11-06-2010 at 09:33 AM.

+ Reply to Thread

Similar Threads

  1. cant creat mysql database
    By mr_osis44 in forum Free Hosting
    Replies: 0
    Last Post: 09-19-2010, 03:03 AM
  2. help on how to creat support ticket
    By iykemega31 in forum Free Hosting
    Replies: 1
    Last Post: 09-11-2010, 05:28 AM
  3. Could not creat hosting account
    By pankajp in forum Free Hosting
    Replies: 2
    Last Post: 03-11-2010, 02:18 PM
  4. Hello, How to creat MySQL?
    By comsup in forum Introductions
    Replies: 0
    Last Post: 03-18-2009, 03:17 AM
  5. can't creat account :(
    By Bananab in forum Free Hosting
    Replies: 1
    Last Post: 07-09-2008, 09:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers