Jump to content

Getting clean urls for SEO


laflair13

Recommended Posts

Hey all, Not sure if this is the right section, So I apologize if not and please move to correct area.

 

Ok, my question is, I have a site where I can add stuff quick through the admin. But it gives is a numeric url.

 

And example

mydomain.com/pop.php?Play=179

 

But I want it to say something like

 

mydomain.com/here-is-a-seo-page

 

Is there any way to do this, and if so can you point me in the right direction so I can learn it and put it on my site.

 

Thanks in advance.

Link to comment
Share on other sites

It's all right there in the sticky at the top of this forum, but for quick reference...

 

If your server does have mod_rewrite enabled, add the following to your .htaccess file in the same directory as pop.php:

 

RewriteEngine On
RewriteRule		^([0-9-]+)$		pop.php?Play=$1 [L]

 

This will make it so any request for "http://mydomain.com/179" loads "http://mydomain.com/pop.php?Play=179"

 

Alternatively you could make it look like "http://mydomain.com/play/179" like this:

 

RewriteEngine On
RewriteRule		^/play/([0-9-]+)$		pop.php?Play=$1 [L]

 

If you want to do anything more advanced, I suggest checking out the cheat sheet in the sticky.

Link to comment
Share on other sites

That wouldn't be too hard, you just need to use this:

 

RewriteEngine On
RewriteRule      ^/play/([A-Za-z0-9-]+)$      pop.php?Play=$1 [L]

 

And then have a php function to take $_GET['Play'] (which would contain shows-title) and search your database for the correct thing to play.

 

 

Unless I'm misunderstanding and you want it to retrieve the title from the database and insert it in the url?

Link to comment
Share on other sites

Well, you can't change the URL once the page has been loaded... the point of a url is to access a page.

 

Nope, you don't have to rename it.

 

RewriteEngine On
RewriteRule      ^/stream/([A-Za-z0-9-]+)$      pop.php?Play=$1 [L]

 

Will do that.

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.