Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15609
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: change page url according to id |
| Date | 2015-07-22 23:45 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <mop9uu$jp8$1@dont-email.me> (permalink) |
| References | (2 earlier) <c9ebddf7-5d0a-4548-a0a2-8cef38d99ea3@googlegroups.com> <mok4r9$cqi$1@dont-email.me> <6rurx.288487$Pb6.182445@fx04.iad> <1473148.XobnLxc11U@PointedEars.de> <fd692e5f-69bb-42bd-bacf-c875a879c5e7@googlegroups.com> |
On Wed, 22 Jul 2015 06:10:05 -0700, apoorv.kanungo wrote: > Guys I am sorry if I did not put my question correctly I know we can do > that with htaccess but I have to manually enter redirect code in the > htaccess. > > I want it to be dynamic so that if user enter title of the page contact > us the url in the browser will be example.com/contact us. > > kind of like wordpress where it does not have multiple pages but one > default template and url and title of all the pages are different. > > can we do that with $_SERVER['REQUEST_URI'] I thought I answered this already! You set up your htaccess so that everything goes to a php page. In the php page, you look at the server request variable and use that to calculate which content to deliver. The url shown in the browser address bar will be the url that it requested. If you wish to change this, you need to use a redirect to the url that wish to have displayed. You can do this in the same php page. In apache, at the host level, use: AliasMatch ^/.* /index.php Then every request will get passed to /index.php. In /index.php, you can look at any request data (post or get) as well as the request uri, and then decide to do one of the following: (a) Display content relevant to the request uri; or (b) Issue a redirect header from the php to change the request uri; or (c) Display default content So then a request for http:/blah.blah.blah/blah?id=15 can trigger a redirect to http:/blah.blah.blah/documents (because your php knows that id 15 is documents), and http:/blah.blah.blah/documents gets processed according to the request uri and the documents content is delivered to the visitors browser. Note that whether you do the redirections and processing in apache or php, there is a need to first of all create and then manage mappings of (a) id to content name and (b) content name to content source. -- Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
change page url according to id adam <apoorv.kanungo@gmail.com> - 2015-07-19 23:08 -0700
Re: change page url according to id gordonb.dc822@burditt.org (Gordon Burditt) - 2015-07-20 03:14 -0500
Re: change page url according to id apoorv.kanungo@gmail.com - 2015-07-20 03:06 -0700
Re: change page url according to id Richard Damon <Richard@Damon-Family.org> - 2015-07-20 08:29 -0400
Re: change page url according to id Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-21 00:47 +0000
Re: change page url according to id Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-07-21 12:28 -0400
Re: change page url according to id Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-21 22:04 +0200
Re: change page url according to id apoorv.kanungo@gmail.com - 2015-07-22 06:10 -0700
Re: change page url according to id gordonb.8ssp0@burditt.org (Gordon Burditt) - 2015-07-22 17:34 -0500
Re: change page url according to id "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-07-23 01:12 +0200
Re: change page url according to id Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-22 23:45 +0000
Re: change page url according to id Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-24 08:28 +0200
csiph-web