Page 1 of 1

How to create a customized URL/page

Posted: Wed Oct 01, 2014 5:11 pm
by David_deb
Hello,

What I'd like is to be able to send a person to a unique page via a customized link including it's name and displaying it on the page.

So, to be clear, I have a page at this URL:
mysite.com/video/

I send an email to the person, let's say his name is Joe so I just add Joe to the URL:
mysite.com/video/joe
He is then sent to the page and can see somewhere on the page his name, like "Hello Joe, watch the video I did for you...".

If his name is Jane then the URL would be:
mysite.com/video/jane

I just want to have one page and that whatever I add to the URL it would drive the person to the URL mysite.com/video/
This is to avoid to have to create an identical page X times, one for Joe, one for Jane, one for David...

It certainly is easy but as I'm just a beginner in PHP, it's not so obvious for me.

Thanks a lot for your help.

David

Re: How to create a customized URL/page

Posted: Wed Oct 01, 2014 7:16 pm
by Celauran
You basically want a rewrite rule in your .htaccess file (assuming you're using Apache). This should do the trick:

Code: Select all

RewriteEngine On
RewriteRule ^video/(.*)/? video/?q=$1 [NC,L]

Re: How to create a customized URL/page

Posted: Thu Oct 02, 2014 2:11 pm
by David_deb
Celauran wrote:You basically want a rewrite rule in your .htaccess file (assuming you're using Apache). This should do the trick:

Code: Select all

RewriteEngine On
RewriteRule ^video/(.*)/? video/?q=$1 [NC,L]
Thanks for this code. But I never used any command to change the .htaccess file except for scripts I purchased and then just copy/paste some piece of code in the file.

q=$1 is a variable I could use in my script on the .php page? It would contain the text entered in the URL after the mysite.com/video/?

Thank you very much for your help.

Re: How to create a customized URL/page

Posted: Thu Oct 02, 2014 3:06 pm
by Celauran
It was just an example. q can be anything you want. If would be available to the script through $_GET['q'] (or whatever you call q)

Re: How to create a customized URL/page

Posted: Fri Oct 03, 2014 4:26 am
by Jaz Madrid
Thanks, I had the same quiestion

Re: How to create a customized URL/page

Posted: Fri Oct 03, 2014 1:24 pm
by David_deb
Thank you very much Celauran.