Tag Archives: url

SEO friendly urls after submiting a form

What means that?
It means that in a form whit GET method, when you submit, you will be redirected to a new page with “?example=variable” added to the URL.
Think if your users will search on your site some data and wish to place the link with the searched results on blogs,forum will have an ugly URL,but the most of all you will lose characters spaces for more keywords for SEO.
Here is an example:
This is a default form submitted url:

www.example.com/search?category=some+simple+data+that+makes+your+url+inefficient

And a pretty one:
www.example.com/some-simple-data-that-makes-your-url-efficient-for-search-engines-s

In the last example your link has 24 characters more used for keywords in the same length the preview has.
How can we do this?Simple.
We will use forms with POST methos.This will send data via POST to a page where it will be redirected to a new location ,the URL rewrited.

<form method=”post>
<input name=”data” type=”text” >
<input type=”submit” >
</form>

The php script should contain on the firs line this:

if (isset($_POST['data']) && $_POST['data']!= ”) {
header( ‘Location: http://www.example.com/preg_replace(”/[^a-zA-Z0-9s ]/”, “-”, $_POST['data'])-s;
die();
}

and the .htaccess file should contain between the lines this(if you have an wordpress do not use this method)

RewriteRule ^([a-zA-Z0-9]+)-s$ redirected-page.php?data=$1

This is all.
Redirected-page.php is the page where you get the requests and show the results.

Place a link to your site with refference to this article,if you want to use this post!!

Link To This Post
1. Click inside the codebox
2. Right-Click then Copy
3. Paste the HTML code into your webpage
codebox

SEO Friendly URL with Mod Rewrite from Apache

What is Mod Rewrite?

According to Wikipedia:

A rewrite engine is a piece of web server software used to modify URLs before fetching the requested item, for a variety of purposes. This technique is known as URL rewriting. A concise URL is easy to remember, and less time-consuming to type in. If the URL can be made to relate clearly to the content of the page, then errors are less likely to happen. More details about mod rewrite here.

Ok now that we have seen what Mod Rewrite actually does we will start on learning how to actually rewrite your URL.

If you have a website and your pages links form are : index.php?id_cat=10 you can optimize them to look like 10_keyword.html with a little effort and knowledges.

Create .htaccess file in root or edit if exists and add the following lines:


#Options +FollowSymLinks
#RewriteEngine on
#RewriteRule ^([0-9]+)-[a-zA-Z0-9-_]*.html$ index.php?id_cat=$1 [L]

If you don’t have knowledges about mod rewrite you can use some mod rewrite generators like Mod rewrite generator 1 , Mod rewrite generator 2 or try Google.

Place a link to your site with refference to this article,if you want to use this post!!

Link To This Post
1. Click inside the codebox
2. Right-Click then Copy
3. Paste the HTML code into your webpage
codebox