<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>آموزش وب و لینوکس و همه چیز در این حول و حوش &#187; بهینه سازی &#8211; سئو</title>
	<atom:link href="/category/seo/feed/" rel="self" type="application/rss+xml" />
	<link>http://tuts.zanjanlug.org</link>
	<description>آموزش برنامه نویسی وب،لینوکس و همه چیز در این حول و حوش</description>
	<lastBuildDate>Thu, 13 Jun 2013 02:21:10 +0000</lastBuildDate>
	<language>fa-IR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6.1</generator>
		<item>
		<title>نکاتی در مورد htaccess</title>
		<link>http://tuts.zanjanlug.org/optimizehtaccess/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=optimizehtaccess</link>
		<comments>http://tuts.zanjanlug.org/optimizehtaccess/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:51:05 +0000</pubDate>
		<dc:creator>saeedit</dc:creator>
				<category><![CDATA[امنیت]]></category>
		<category><![CDATA[بهینه سازی - سئو]]></category>
		<category><![CDATA[پی اچ پی]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[آپاچی]]></category>
		<category><![CDATA[وب سرور]]></category>

		<guid isPermaLink="false">http://www.phpdevelopers.ir/?p=1135</guid>
		<description><![CDATA[تنظیمات وب سرور یکی از موارد همیشه چالش دار بوده( به نظر من ). اگه با وب سروری مثل Apache آشنایی کافی داشته باشید و البته دسترسی لازم به سرور, به راحتی می تونید Apache رو Optimize کنید. ولی در &#8230; <a href="/optimizehtaccess/"><span class='more-link'>ادامه ی مطلب</span></a>]]></description>
				<content:encoded><![CDATA[<p><img src="http://www.phpdevelopers.ir/wp-content/uploads/2012/01/02-301-redirect-150x150.jpg" alt="" width="150" height="150" class="alignright size-thumbnail wp-image-1156" />تنظیمات وب سرور یکی از موارد همیشه چالش دار بوده( به نظر من ). اگه با وب سروری مثل Apache آشنایی کافی داشته باشید و البته دسترسی لازم به سرور, به راحتی می تونید Apache رو Optimize کنید. ولی در بسیاری از سرور ها یا هاستینگ ها شما تنها به فایل htaccess. دسترسی دارید که به کمک اون می تونید تنظیمات دلخواه رو برای افزایش بهینگی برنامه و وب سرور ایجاد کنید. بریم سراغ این فایل&#8230;.<span id="more-1135"></span></p>
<p>اگر به سایت <a title="No-www" href="http://no-www.org" target="_blank">no-www</a>  سر بزنید اونجا دلایل کافی برای عدم استفاده از www در url ها به صورت پیش فرض آورده شده, و می تونید مطالعه کنید. ما از دستورات زیر داخل فایل htaccess. برای این کار استفاده می کنیم:</p>
<pre class="brush: bash; title: ; notranslate">

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

</pre>
<p>&nbsp;</p>
<p>برای تنظیم دسترسی به خود وب سایت یا برنامه می تونیم از دستورات زیر استفاده کنیم.همچنین باید دسترسی به خود فایل htaccess. رو محدود کنیم.</p>
<pre class="brush: bash; title: ; notranslate">

&lt;Limit GET POST PUT&gt;
    order deny,allow
    allow from all
&lt;/Limit&gt;

&lt;Files .httaccess&gt;
    order allow,deny
    deny from all
&lt;/Files&gt;

</pre>
<p>&nbsp;</p>
<p>یکی از مواردی که هم برای امنیت و هم برای بهینگی اهمیت داره بحث Canonical هستش. Bot  ها و یا مرورگر های مختلف ممکنه درخواست های مختلفی رو برای دسترسی به sitemap, favicon, robots.txt  با هدف های متفاوتی ارسال کنند. حالا کاری که ما باید بکنیم اینه که تمامی درخواست ها به این فایل ها رو از طریق هر مدل url به فایل های اصلی که معمولا در root directory هستند redirect کنیم.</p>
<pre class="brush: bash; title: ; notranslate">

# CANONICAL ROBOTS.TXT

 RewriteBase /
 RewriteCond %{REQUEST_URI} !^/robots.txt$ [NC]
 RewriteCond %{REQUEST_URI} robots.txt [NC]
 RewriteRule .* http://sample.ir/robots.txt [R=301,L]

</pre>
<pre class="brush: bash; title: ; notranslate">

# CANONICAL FAVICONS
 RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_URI} !^/favicon.ico$ [NC]
 RewriteCond %{REQUEST_URI} /favicon(s)?.?(gif|ico|jpe?g?|png)?$ [NC]
 RewriteRule (.*) http://sample.ir/images/icon.png [R=301,L]

# CANONICAL SITEMAPS
RedirectMatch 301 /sitemap.xml$ http://sample.ir/site_map.xml

</pre>
<p>&nbsp;</p>
<p>Error Handling کلا یکی از مواردی بسیار با اهمیت هست. تاثیر این موضوع بر  SEO, Security, Readabilty, Extending, etc      کاملا مشهود هستش و البته برای کلاس کار برنامه نویس هم بسیار مهمه. دستورات زیر امکان کنترل کردن این خطا ها رو از سمت سرور و یا ناشی از داده های غلط رو به ما می دهد.<br />
( یه تجربه مشترک: هممون Error های هر چند وقت یکبار پرتال نما های دانشگاهی رو دیدیم )</p>
<pre class="brush: bash; title: ; notranslate">

## Custom error messages
	ErrorDocument 400 http://sample.ir/error.php?n=400
	ErrorDocument 401 http://sample.ir/error.php?n=401
	ErrorDocument 402 http://sample.ir/error.php?n=402
	ErrorDocument 403 http://sample.ir/error.php?n=403
	ErrorDocument 404 http://sample.ir/error.php?n=404
	ErrorDocument 405 http://sample.ir/error.php?n=405
	ErrorDocument 406 http://sample.ir/error.php?n=406
	ErrorDocument 407 http://sample.ir/error.php?n=407
	ErrorDocument 408 http://sample.ir/error.php?n=408
	ErrorDocument 409 http://sample.ir/error.php?n=409
	ErrorDocument 410 http://sample.ir/error.php?n=410
	ErrorDocument 411 http://sample.ir/error.php?n=411
	ErrorDocument 412 http://sample.ir/error.php?n=412
	ErrorDocument 413 http://sample.ir/error.php?n=413
	ErrorDocument 414 http://sample.ir/error.php?n=414
	ErrorDocument 415 http://sample.ir/error.php?n=415
	ErrorDocument 416 http://sample.ir/error.php?n=416
	ErrorDocument 417 http://sample.ir/error.php?n=417
	ErrorDocument 422 http://sample.ir/error.php?n=422
	ErrorDocument 423 http://sample.ir/error.php?n=423
	ErrorDocument 424 http://sample.ir/error.php?n=424
	ErrorDocument 426 http://sample.ir/error.php?n=426
	ErrorDocument 500 http://sample.ir/error.php?n=500
	ErrorDocument 501 http://sample.ir/error.php?n=501
	ErrorDocument 502 http://sample.ir/error.php?n=502
	ErrorDocument 503 http://sample.ir/error.php?n=503
	ErrorDocument 504 http://sample.ir/error.php?n=504
	ErrorDocument 505 http://sample.ir/error.php?n=505
	ErrorDocument 506 http://sample.ir/error.php?n=506
	ErrorDocument 507 http://sample.ir/error.php?n=507
	ErrorDocument 510 http://sample.ir/error.php?n=510

</pre>
<p>بعد از این قست ما نیاز به یک فایل به نام error.php  داریم که اونو به صورت زیر در آوردم:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php

$GP_flag = true;

if( isset($_GET['n']) ){
	$error = $_GET['n'];
	$error = addslashes($error);
}

$code = array(
  111 =&gt; 'Invalid Data',
  222 =&gt; 'Access Denied!',
  400 =&gt; 'Bad Request',
  401 =&gt; 'Unauthorized',
  402 =&gt; 'Payment Required',
  403 =&gt; 'Forbidden',
  404 =&gt; 'Not Found',
  405 =&gt; 'Method Not Allowed',
  406 =&gt; 'Not Acceptable',
  407 =&gt; 'Proxy Authentication Required',
  408 =&gt; 'Request Timeout',
  409 =&gt; 'Conflict',
  410 =&gt; 'Gone',
  411 =&gt; 'Length Required',
  412 =&gt; 'Precondition Failed',
  413 =&gt; 'Request Entity Too Large',
  414 =&gt; 'Request-URI Too Long',
  415 =&gt; 'Unsupported Media Type',
  416 =&gt; 'Requested Range Not Satisfiable',
  417 =&gt; 'Expectation Failed',
  422 =&gt; 'Unprocessable Entity',
  423 =&gt; 'Locked',
  424 =&gt; 'Failed Dependency',
  426 =&gt; 'Upgrade Required',
  500 =&gt; 'Internal Server Error',
  501 =&gt; 'Not Implemented',
  502 =&gt; 'Bad Gateway',
  503 =&gt; 'Service Unavailable',
  504 =&gt; 'Gateway Timeout',
  505 =&gt; 'HTTP Version Not Supported',
  506 =&gt; 'Variant Also Negotiates',
  507 =&gt; 'Insufficient Storage',
  510 =&gt; 'Not Extended'
  );

 $msg = array(
  111 =&gt; &quot;Sending Data is not Valid&quot;,
  222 =&gt; &quot;URL is not Valid&quot;,
  400 =&gt; &quot;Your browser sent a request that this server could not understand.&quot;,
  401 =&gt; &quot;This server could not verify that you are authorized to access the document requested.&quot;,
  402 =&gt; &quot;The server encountered an internal error or misconfiguration and was unable to complete your request.&quot;,
  403 =&gt; &quot;You don't have permission to access here on this server.&quot;,
  404 =&gt; &quot;We couldn't find &lt;acronym&gt;that uri&lt;/acronym&gt; on our server, though it's most certainly not your fault.&quot;,
  405 =&gt; &quot;The requested method is not allowed for the URL.&quot;,
  406 =&gt; &quot;An appropriate representation of the requested resource could not be found on this server.&quot;,
  407 =&gt; &quot;An appropriate representation of the requested resource could not be found on this server.&quot;,
  408 =&gt; &quot;Server timeout waiting for the HTTP request from the client.&quot;,
  409 =&gt; &quot;The server encountered an internal error or misconfiguration and was unable to complete your request.&quot;,
  410 =&gt; &quot;The requested resource is no longer available on this server and there is no forwarding address. Please remove all
  		   references to this resource.&quot;,
  411 =&gt; &quot;A request of the requested method GET requires a valid Content-length.&quot;,
  412 =&gt; &quot;The precondition on the request for the URL evaluated to false.&quot;,
  413 =&gt; &quot;The requested resource does not allow request data with GET requests, or the amount of data provided in the request
  		  exceeds the capacity limit.&quot;,
  414 =&gt; &quot;The requested URL's length exceeds the capacity limit for this server.&quot;,
  415 =&gt; &quot;The supplied request data is not in a format acceptable for processing by this resource.&quot;,
  416 =&gt; &quot;Requested Range Not Satisfiable&quot;,
  417 =&gt; &quot;The expectation given in the Expect request-header field could not be met by this server. The client sent &lt;code&gt;Expect:
 &lt;/code&gt;&quot;,
  422 =&gt; &quot;The server understands the media type of the request entity, but was unable to process the contained instructions.&quot;,
  423 =&gt; &quot;The requested resource is currently locked. The lock must be released or proper identification given before the method can
  		  be applied.&quot;,
  424 =&gt; &quot;The method could not be performed on the resource because the requested action depended on another action and that other
  		  action failed.&quot;,
  425 =&gt; &quot;The server encountered an internal error or misconfiguration and was unable to complete your request.&quot;,
  426 =&gt; &quot;The requested resource can only be retrieved using SSL. Either upgrade your client, or try requesting the page using

https://&quot;,

  500 =&gt; 'The server encountered an internal error or misconfiguration and was unable to complete your request.&quot;,
  501 =&gt; &quot;This type of request method is not supported.&quot;,
  502 =&gt; &quot;The proxy server received an invalid response from an upstream server.&quot;,
  503 =&gt; &quot;The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again
  		  later.&quot;,
  504 =&gt; &quot;The proxy server did not receive a timely response from the upstream server.&quot;,
  505 =&gt; 'The server encountered an internal error or misconfiguration and was unable to complete your request.&quot;,
  506 =&gt; &quot;A variant for the requested resource is itself a negotiable resource. This indicates a configuration
  		  error.&quot;,
  507 =&gt; &quot;The method could not be performed.  There is insufficient free space left in your storage allocation.&quot;,
  510 =&gt; &quot;A mandatory extension policy in the request is not accepted by the server for this resource.&quot;
  );

echo $code[$error];
echo $msg[$error];

?&gt;

</pre>
<p>&nbsp;</p>
<p>برای فعال کردن SSI هم از دستورات زیر استفاده می کنیم.</p>
<pre class="brush: bash; title: ; notranslate">

## Enable SSI
AddType text/html .html
AddType text/html .shtml

AddHandler server-parsed .html
AddHandler server-parsed .shtml

</pre>
<p>&nbsp;</p>
<p>اگه شما یک Developer باشید و از افزونه هایی مثل YSlow, Firebug و &#8230; استفاده کنید می بینید که به عدم فشرده شدن داده ها و بحث Caching و Expire حسابی گیر می دن. یکی از راه های ساده برای Optimize کردن این موارد استفاده کردن از دستورات زیر هستش.</p>
<pre class="brush: bash; title: ; notranslate">

## Adding an Expires Header

    Header set Expires &quot;Thu, 15 Apr 2012 20:00:00 GMT&quot;

    #Compress
    SetOutputFilter DEFLATE

</pre>
<p>علاوه بر این که به کمک خود PHP هم می تونیم داده ها رو Compress کنیم, این دستورات وب سرور رو وادار می کنه تا فایل هایی رو که ما در پایین مشخص کردیم به صورت فشرده شده به سمت کاربر ارسال کنه.</p>
<pre class="brush: bash; title: ; notranslate">

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

</pre>
<p>&nbsp;</p>
<p>سعی کردم چند تا از مهم ترین موارد رو ذکر کنم.<br />
در مورد منابع هم چند تا سایت مختلف رو معرفی می کنم که احتمالا شما دوستان اون ها رو قبل از من شناختید.<br />
<a href="http://www.securityplanet.com" target="_blank">http://www.securityplanet.com</a><br />
<a href="http://www.securityplanet.com" target="_blank">http://www.askapache.com</a><br />
<a href="http://phpmaster.com" target="_blank">phpmaster.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tuts.zanjanlug.org/optimizehtaccess/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>وردپرس و پیوند یکتا</title>
		<link>http://tuts.zanjanlug.org/%d9%88%d8%b1%d8%af%d9%be%d8%b1%d8%b3-%d9%88-%d9%be%db%8c%d9%88%d9%86%d8%af-%db%8c%da%a9%d8%aa%d8%a7/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25d9%2588%25d8%25b1%25d8%25af%25d9%25be%25d8%25b1%25d8%25b3-%25d9%2588-%25d9%25be%25db%258c%25d9%2588%25d9%2586%25d8%25af-%25db%258c%25da%25a9%25d8%25aa%25d8%25a7</link>
		<comments>http://tuts.zanjanlug.org/%d9%88%d8%b1%d8%af%d9%be%d8%b1%d8%b3-%d9%88-%d9%be%db%8c%d9%88%d9%86%d8%af-%db%8c%da%a9%d8%aa%d8%a7/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 09:50:36 +0000</pubDate>
		<dc:creator>chalist</dc:creator>
				<category><![CDATA[بهینه سازی - سئو]]></category>
		<category><![CDATA[وردپرس]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[parramlink]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[پیوند یکتا]]></category>

		<guid isPermaLink="false">http://www.phpdevelopers.ir/?p=825</guid>
		<description><![CDATA[شاید خیلی از شماها مثل من به این مشکل برخورده باشید که وقتی پیوند یکتای وردپرس رو تغییر می دید برگه هایی که قبلن ساخته شدن دیگه کار نمی کنن. یا اینکه حتمن باید نامک برگه رو انگلیسی وارد کنید. &#8230; <a href="/%d9%88%d8%b1%d8%af%d9%be%d8%b1%d8%b3-%d9%88-%d9%be%db%8c%d9%88%d9%86%d8%af-%db%8c%da%a9%d8%aa%d8%a7/"><span class='more-link'>ادامه ی مطلب</span></a>]]></description>
				<content:encoded><![CDATA[<p><img src="http://www.phpdevelopers.ir/wp-content/uploads/2011/03/wordpress-logo-150x150.png" alt="" title="wordpress-logo" width="150" height="150" class="alignright size-thumbnail wp-image-820" />شاید خیلی از شماها مثل من به این مشکل برخورده باشید که وقتی پیوند یکتای وردپرس رو تغییر می دید برگه هایی که قبلن ساخته شدن دیگه کار نمی کنن. یا اینکه حتمن باید نامک برگه رو انگلیسی وارد کنید. وردپرس فارسی این مشکل رو داره که وقتی پیوند یکتا رو تغییر می دی بهت نمی گه چی کار کنی. در واقع شما وقتی با وردپرس اصلی این کارو بکنید بهتون می گه یه فایل .htaccess بسازید و تغییرش بدید. اما در وردپرس فارسی حتمن باید فایل htaccess رو بسازید و بعد پیوند یکتا رو تغییر بدید تا <span id="more-825"></span>بهتون بگه چی کار باید بکنید.</p>
<p>من خودم برای پیوند یکتای وردپرس از %postname% استفاده می کنم. یعنی آدرس هام رو از این حالت:</p>
<pre class="brush: plain; title: ; notranslate">

http://www.phpdevelopers.ir/?p=123

</pre>
<p>تغییر می دم به این حالت:</p>
<pre class="brush: plain; title: ; notranslate">

http://www.phpdevelopers.ir/sample-post/

</pre>
<p>برای تغییر دادن پیوند یکتا می تونید به بخش تنظیمات > پیوند یکتا برید و هر حالت دیگه ای که مد نظرتونه رو انتخاب کنید.</p>
<p>قبل از این کار برای اینکه در وردپرس فارسی به مشکل بر نخوریم باید در شاخه ی root یه فایل بسازیم به نام htaccess. و بعد به بخش پیوند یکتا بریم و اون حالتی رو که می خوایم انتخاب کنیم و کلید ذخیره کنید رو بزنیم. پس از به روز شدن و ذخیره شدن تنظیمات در پایین صفحه یه کد بهتون داده می شه که باید اون رو در فایل htaccess. اضافه کنید. کدی شبیه به این:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase root
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /q-fa/index.php [L]
&lt;/IfModule&gt;

</pre>
<p>مشکل شما حل شد.<br />
دقت کنید که اگر به صورت لوکال ار وردپرس استفاده می کنید <a href="http://www.phpdevelopers.ir/%d9%81%d8%b9%d8%a7%d9%84-%da%a9%d8%b1%d8%af%d9%86-mode_rewrite-%d8%af%d8%b1-%d8%a7%d9%88%d8%a8%d9%88%d9%86%d8%aa%d9%88/">به این پست</a> مراجعه کنید<br />
موفق باشید</p>
]]></content:encoded>
			<wfw:commentRss>http://tuts.zanjanlug.org/%d9%88%d8%b1%d8%af%d9%be%d8%b1%d8%b3-%d9%88-%d9%be%db%8c%d9%88%d9%86%d8%af-%db%8c%da%a9%d8%aa%d8%a7/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->