Hi
This seems a common thing to do, but I don't know how.......
How do you setup script so a page can be viewed through a short url.
For example, http://www.mywebpage.co.uk/conveyancing-quote/
Can a script be made so that /conveyancing-quote/ is the shorturl for
http://www.mywebpage.co.uk/index.php?page=45&s=332 ??
I know how to do a redirector in HTML, but this is different.
Simon
Shortcode...URL. /contact-us/
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Shortcode...URL. /contact-us/
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Shortcode...URL. /contact-us/
There's a rule on the server that says "if this thing can't be found, go here". It happens internally so you (the user) don't see that you're being redirected to index.php?...
If you're using Apache with mod_rewrite:
Your index.php has two purposes now: one is to serve the front page to the website, the other is to handle shortcuts. (You could have a PHP file specifically handle shortcuts if you wanted.)
index.php can look at $_GET["shortcut"] to see if it's supposed to serve something. It gets the "conveyancing-quote" and decides what to do from there.
If you're using Apache with mod_rewrite:
Code: Select all
RewriteEngine On
RewriteRule %{REQUEST_FILENAME} !-f
RewriteRule %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?shortcut=$0index.php can look at $_GET["shortcut"] to see if it's supposed to serve something. It gets the "conveyancing-quote" and decides what to do from there.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Shortcode...URL. /contact-us/
Thank you.
I will look up and research $_GET["shortcut"] to see how to make it all happen, as it looks like a standard PHP method.
Regards
Simon
I will look up and research $_GET["shortcut"] to see how to make it all happen, as it looks like a standard PHP method.
Regards
Simon
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Shortcode...URL. /contact-us/
Hi - this doesn't seem as straight forward as I thought, and there isn't all that much about it on the web.
ie. I would have thought there's be a /page/ type script somewhere, with the url it directs to, and an include or something in the index.php file that does it all.
Not as simple as that??
ie. I would have thought there's be a /page/ type script somewhere, with the url it directs to, and an include or something in the index.php file that does it all.
Not as simple as that??
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.