Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SEO for PHP URLs?

Tags:

php

seo

I have many thousands of profile URLs that currently look like this:

view_profile.php?id=12345

Is there any SEO benefit for me to change them to something like:

member12345.htm

I can make the change in my .htaccess file but I'm curious if it's even needed?

like image 348
Paul Avatar asked Jul 11 '26 05:07

Paul


2 Answers

The easy solution edit your .htaccess file:

RewriteEngine On
RewriteBase /

RewriteRule ^member([0-9]+)\.htm(l)?$ view_profile.php?id=$1 [L,NC]
#or /member-1234.html
RewriteRule ^member\-([0-9]+)\-([^/])\.htm(l)?$ view_profile.php?id=$1 [L,NC]
#or /member-1234-user-name/
RewriteRule ^member\-([0-9]+)\-([^/]+)/?$ view_profile.php?id=$1 [L,NC]

L mean last rule, so if the regular expression is match, it will stop there.

NC mean non case so capital letters like ABC are treated the same as lowercase like abc.

like image 197
rcs20 Avatar answered Jul 13 '26 21:07

rcs20


If you want these member pages to be found at Search Engines, it'd be good to do a change like this. But only moving the number around would help little , but not much.

To really get an effect, you need to put meaningful words in the URL, e.g. member-12345-max-weller.htm for my profile ;-)

This is because Google & Co. supposedly like static pages better than dynamic pages.

like image 24
Mira Weller Avatar answered Jul 13 '26 21:07

Mira Weller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!