Hello!
When i create PHP apps i create link like domain.com/page?variable=&variable2 , but this is not seo friendly.
How can i make link like: domain.com/variable/variable2 and GET variable value.
Create friendly seo link
-
- Posts:39
Create friendly seo link
Admin
Posts:805
Hi,
You can create friendly seo links with mod_rewrite in the .htaccess file.
For example:
Then, in html add the friendly link:
And, in php you can use a code like this to get the "some_val" and "other_val":
To learn about this, just look on the net for: " mod_rewrite htaccess ".
- You need to know /learn a little about RegExp (regular expressions) to write the expression to "RewriteRule" according to the link you want.
You can create friendly seo links with mod_rewrite in the .htaccess file.
For example:
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([A-z0-9_\-]+)/([A-z0-9_\-]+)$ page.php?v1=$1&v2=$2 [NC,L]
Code: Select all
<a href="//domain.com/some_val/other_val" title="Text">Text</a>
Code: Select all
$v1 = isset($_GET['v1']) ? $_GET['v1'] :'';
$v2 = isset($_GET['v2']) ? $_GET['v2'] :'';
- You need to know /learn a little about RegExp (regular expressions) to write the expression to "RewriteRule" according to the link you want.