Seo

JerseyFoo

1/g = g-1
Reaction score
40
How about "http://www.site.com/watch-naruto-online-episode-40/".

I'd store the locations in a database, and have a php file load the correct page.

In your .htaccess file
Code:
RewriteEngine On
RewriteRule ^([^/\.]+)/?$ /phpfile.php?u=$1 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /phpfile.php?u=$1/$2 [L]

Course maybe this is a bit advanced... or maybe SEO is a bit advanced.
 

ertaboy356b

Old School Gamer
Reaction score
86
Uhmm.. I don't have full control over my php configuration... I am using a free shared host server with php and mysql ^^
 

JerseyFoo

1/g = g-1
Reaction score
40
And what you need is php and mysql.

Imagine a database table setup like this
Code:
Redirs
Loc                                              Id                 Ep
watch-naruto-online-episode-40                       47                 1932
....                                              ...                 ...

PHP File
PHP:
<?php
    if ( isset($_GET['u']) ){
        // Put connect to database stuff here or before
        $u = strtolower($_GET['u']);
        $u = mysql_real_escape_string($u);
        $q = "SELECT * FROM `Redirs` WHERE `Loc` = '" . $u . "' LIMIT 0,1";
        $r = mysql_query($q);
        if ( $r ){
            while ( $v = mysql_fetch_array($r) ){  // Only cause I don't know a better way offhand
                 $id = $v['Id'];
                 $ep = $v['Ep'];
            }
        }
    }

    if ( $ep ){
        // A page was found
        // echo teh contents
        // $ep is = ep, $id is = id
    } else {
        // Page not found, echo teh 404
    }
?>

And the .htaccess is a text file like a php file or html, except it's name ".htaccess" ( no extension ) and is placed in your sites directory.

With this as your .htaccess...
Code:
RewriteEngine On
RewriteRule ^([^/\.]+)/?$ /phpfile.php?u=$1 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /phpfile.php?u=$1/$2 [L]
# this is a comment
# '([^/\.]+)' means "anything of 1 or more characters except '.' and '/', and also pass whatever this is to variable $1"

When someone goes to "http://www.domain.com/something-blah/", they are really going to "http://www.domain.com/phpfile.php?u=something-blah" but it shows as the nice url. Just having the SEO as a part of a long php query url isn't going to help you much more than just using titles and descriptive content.
 

ertaboy356b

Old School Gamer
Reaction score
86
Care to check out the site?? I think the title and content are fine.. The only problem is the url (and maybe some meta, wait, does meta counts??)..
 

JerseyFoo

1/g = g-1
Reaction score
40
Getting a good domain name would be a good idea. They're cheap, $10 a year, - godaddy.com - max 3 syllables, easy to spell, 9 characters max, something like that.

Google will probably ignore the entire SEO part of your url due to it's length, shorter URLs are better both for bots and humans. But, what do ya have to lose?

Meta counts so that your site can have a nice description on google. I really doubt it matters beyond that.
 

ertaboy356b

Old School Gamer
Reaction score
86
Getting a good domain name would be a good idea. They're cheap, $10 a year, - godaddy.com - max 3 syllables, easy to spell, 9 characters max, something like that.

Google will probably ignore the entire SEO part of your url due to it's length, shorter URLs are better both for bots and humans. But, what do ya have to lose?

Meta counts so that your site can have a nice description on google. I really doubt it matters beyond that.

Yeah, I thought of that too.. But I don't have money to buy a domain for now.. I don't even have a bank account.. Maybe when I'm a little richer ^^
 

ertaboy356b

Old School Gamer
Reaction score
86
I've tried it.. It doesn't.. It frames my site.. I've used it for years (before I learned php)..
 

DDRtists

ɹoʇɐɹǝpoɯ ɹǝdns
Reaction score
415
I'd just like to throw this in here:

Google won't cache php pages more than once with different variables.
Example:
mysite.com/index.php?pageid=1
mysite.com/index.php?pageid=2
Google would just see "index.php" and would cache it and move on.

Like JerseyFoo said, using the rewrite rule setup and then making it look like
mysite.com/page/1
mysite.com/page/2
Google will think they're two different pages, and cache them as such.
 

ertaboy356b

Old School Gamer
Reaction score
86
I've found an absolute free domain name.. "co.cc" ...
I registered 2 domains and parked them on my website "anime-medium.co.cc" and "media6.co.cc" ...

I'll try to learn the rewrite rule.. If possible, I will change host provider.. I found a decent one so far, phpnet.us ... I don't know if they will let you .htaccess to be edited..

EDIT:

I've tried a simple script.. looks like it doesn't work..

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule index-p-(.*)-show-(.*)-id-(.*)-ep-(.*)\.htm$ index.php?p=$1&show=$2&id=$3&ep=$4
 

JerseyFoo

1/g = g-1
Reaction score
40
Well google defiently does index query strings to a degree, just google "site:thehelper.net" Non queried come up first, but most of them are query (showthread.php)

I don't see why the Sym links is needed.

I'm not very learned with the htaccess myself, but to do that I'd try this..

Code:
RewriteRule ^video/([^/\.]+)/([^/\.]+)/([^-/\.]+)-([^-/\.]+)/?$ /index.php?p=$1&show=$2&id=$3&ep=$4 [L]

That should make it so "domain.com/video/p/show/id-ep/" will work. The 'video/' is only there to determine that this is indeed a video and can be removed.

Notice the last 2 have a '-' added after the '^'. That means to exclude '-' so it'll stop at the next '-'. You may also notice the '/' and the '\.' after those for all of them, that means to stop at '/' and '.'

The "/?" means slash or no slash so both will work. The "$" signifies the end of the URI. If you want the '.html., just replace the "/?" with "\.html". "\.(html|htm)" could also be used for more than one extension.
 

enouwee

Non ex transverso sed deorsum
Reaction score
240
PHP:
$u = strtolower($_GET['u']);
$q = "SELECT * FROM `Redirs` WHERE `Loc` = '$u' LIMIT 0,1";

You've got some really bad SQL injection in there. Please post snippets without security holes, as some people may be stupid enough to copy/paste your code into their site.

And no, magic quotes is not a valid reason to omit input sanitization.
 

JerseyFoo

1/g = g-1
Reaction score
40
You can't put quotes in a URI or GET for that matter. I'm not aware of any other ways to inject, perhaps you could educate us?

Besides, that is just an example write-up. The code won't work without modification, and if their 'stupid enough' ( in-experienced ) to do that than they are 'stupid enough' to be hacked some other way. It probably doesn't even parse correctly.

Accept help at own risk!
 

JerseyFoo

1/g = g-1
Reaction score
40
But it shows up as %27 in the query?

I've just tested it, MySQL treats it as an escaped; \' The "u=%27+OR+1=1+OR+%27" produced no errors except a page not found.
Code:
Warning: file_get_contents(http://www.dh.yatlist.com/\' OR 1=1 OR \'...) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/dadtech/public_html/dh/omni.php on line 139
 

enouwee

Non ex transverso sed deorsum
Reaction score
240
But it shows up as %27 in the query?

I've just tested it, MySQL treats it as an escaped; \'
Because you've got magic quotes activated (not that I mentioned it above).

That optional configuration "feature" is commonly considered a security risk and will thus be removed from PHP 6.
 

JerseyFoo

1/g = g-1
Reaction score
40
Alright. I've edited the code with mysql_real_escape_string, happy?

PS: I'm a moron for trying to help someone out and you having a problem over the tiny details? It is a write up, it is offhand, it requires modification, it probably doesn't even parse correctly. It is essentially pseudo-code, perhaps you cannot see that?

You've gotta be really ignorant to expect volunteers to post perfect security-hole-free examples as help, isn't it enough I cared to write out any PHP at all?
 

The Helper

Necromancy Power over 9000
Staff member
Reaction score
1,697
Alright. I've edited the code with mysql_real_escape_string, happy?

PS: I'm a moron for trying to help someone out and you having a problem over the tiny details? It is a write up, it is offhand, it requires modification, it probably doesn't even parse correctly. It is essentially pseudo-code, perhaps you cannot see that?

You've gotta be really ignorant to expect volunteers to post perfect security-hole-free examples as help, isn't it enough I cared to write out any PHP at all?

Actually, if you are not going to do it right you should probably just Lurk Moar.
 

JerseyFoo

1/g = g-1
Reaction score
40
Is this even a security hole, can a new select, or delete/insert be injected in this fashion? It is for SEO, not a login.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top