beh9am
سه شنبه 15 مهر 1393, 13:10 عصر
سلام
تشکر بابت انجمن واقعا مشکلاتم خیلی زود برطرف شدن
من از یک سیستم استفاده میکنم که به صورت معمولی به این صورت پست هاش نمایش داده میشه
www.site.com/56985_نام-پست.html
این کدهاش در فایل function.php برای معرفی عنوان مطلب به اون شکل هست:
$str = $C->URL . $type . "/" . $id . "_" . $title . ".html" ;
من تغییرش دادم و به این صورت کردم :
$str = $C->URL . $type . "/" . $title . ".html" ;
پست ها لینکاشون در سایت درست میشه و به این شکل میشن :
www.site.com/نام-پست.html
اما به مطلب که میری خطای 404 میده و مطلب رو نمایش نمیده
ولی اگر مطلب را به صورت این شکلی وارد کنی کار میکنه و مطلب رو میاره
www.site.com/article197105.html
کدهای htaccess سایت هم اینه :
#AddDefaultCharset utf-8
#php_flag display_errors 0
#php_flag magic_quotes_gpc Off
Options +FollowSymlinks
RewriteEngine On
DirectoryIndex index.php index.html
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*) http://%1/$1 [L,R=302]
RewriteRule ^tags/(.+)/page/([0-9]+)/?$ index.php?act=search&tag=$1&page=$2 [QSA,NC,L]
RewriteRule ^tags/(.+)/?\.html$ index.php?act=search&tag=$1 [QSA,NC,L]
RewriteRule ^tags/(.+)/?$ index.php?act=search&tag=$1 [QSA,NC,L]
RewriteRule ^rss/([0-9]+)/(.+)/(.+)/?(\.xml)?$ rss.php?cat=$1 [QSA,NC,L]
RewriteRule ^rss/([0-9]+)/?(.+)?/?(\.xml)?$ rss.php?id=$1 [QSA,NC,L]
RewriteRule ^sitemap.xml/?$ sitemap.php [QSA,NC,L]
RewriteRule ^sitemap2.xml/?$ sitemap2.php [QSA,NC,L]
RewriteRule ^(.+)/([0-9]+)/(.+)/?\.html$ /$1/article$2.html [L,R=301]
RewriteRule ^([0-9]+)/(.+)/?\.html$ /post/article$1.html [L,R=301]
RewriteRule ^(.+)/([0-9]+)_(.+)/?$ /$1/article$2.html [L,R=301]
RewriteRule ^(.+)/article(.+)/?\.html$ index.php?act=$1&id=$2 [QSA,NC,L]
RewriteRule ^cat/([0-9]+)/page/([0-9]+)/?$ index.php?cat=$1&page=$2 [QSA,NC,L]
RewriteRule ^cat/([0-9]+)/(.+)/?\.php$ index.php?cat=$1 [QSA,NC,L]
RewriteRule ^subcat/(.+)/page/([0-9]+)/?$ index.php?catname=$1&page=$2 [QSA,NC,L]
#RewriteRule ^link\.php\?id=([0-9]+)/?$ index.php?id=$1 [QSA,NC,L]
## SubCat's
RewriteRule ^subcat/(.+)/(.+)/page/(.+)/?$ index.php?error=1&subcat=$1&catname=$2&page=$3 [QSA,NC,L]
RewriteRule ^subcat/(.+)/(.+)/?$ index.php?error=1&subcat=$1&catname=$2 [QSA,NC,L]
## SubCat's
## Cat's
RewriteRule ^cat/(.+)/page/(.+)/?$ index.php?error=1&subcat=$1&page=$2 [QSA,NC,L]
RewriteRule ^cat/(.+)/?$ index.php?error=1&subcat=$1 [QSA,NC,L]
## Cat's
RewriteCond %{REQUEST_FILENAME} "!admin/(.*)"
RewriteCond %{REQUEST_FILENAME} "!google(.*)"
RewriteRule ^(.+)/?\.html$ index.php?catname=$1 [QSA,NC,L]
RewriteRule ^page/(.+).php$ index.php?act=page&page=$1 [QSA,NC,L]
## Search ##
#RewriteRule ^items/(.+)/?\.html$ index.php?act=search&tag=$1 [QSA,NC,L]
#RewriteRule ^search/(.+)/?\.html$ index.php?act=search&tag=$1 [QSA,NC,L]
RewriteRule ^(.+)/([0-9]+)/(.+)/?\.html$ index.php?act=$1&id=$2&name=$3 [QSA,NC,L]
RewriteRule ^(.+)/([0-9]+)/?\.html$ index.php?act=$1&id=$2 [QSA,NC,L]
RewriteRule ^(.+)/([0-9]+)_(.+)/?$ index.php?id=$2&title=$3 [QSA,NC,L]
RewriteRule ^([0-9]+)_(.+)/?$ index.php?id=$1&title=$2 [QSA,NC,L]
#RewriteRule ^([0-9]+)_(.+)/?$ index.php?tag=$2 [QSA,NC,L]
RewriteRule ^(.+)/(.+)/page/([0-9]+)/?$ index.php?$1=$2&page=$3 [QSA,NC,L]
RewriteRule ^(.+)?/?page/([0-9]+)/?$ index.php?act=$1&page=$2 [QSA,NC,L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule \.(gif|jpe?g|png|bmp) /userfiles/nopic.jpg [NC,L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^(.+) index.php?error=404 [NC,L]
#AddOutputFilterByType DEFLATE text/html text/plain text/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
# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
<FilesMatch ".*$">
ErrorDocument 404 /index.php?error=404
ErrorDocument 400 /index.php?error=400
ErrorDocument 500 /index.php?error=500
</FilesMatch>
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl|jpg|png|gif)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
AddType application/octet-stream mp3
AddType application/octet-stream mp4
AddType application/octet-stream 3gp
AddType application/octet-stream mpg
AddType application/octet-stream mpeg
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=864000, public"
</FilesMatch>
<FilesMatch ".(xml|txt)$">
Header set Cache-Control "max-age=3600, public, must-revalidate"
</FilesMatch>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
<LimitExcept POST GET>
</LimitExcept>
کد کامل قسمت فانکشن هم اینه :
function make_seo($type,$id,$title) {
global $C ;
if ( $C->POST_SEO == 0 ) return 'http://' . $type . '.' . $C->DOMAIN . '/' . $type . '/article' . $id . '.html' ;
if ( $C->POST_SEO == 0 ) return $C->URL . $type . '/article' . $id . '.html' ;
$title = mb_ereg_replace('[^A-Za-z0-9آ-ی \_\-]+',' ',$title);
$words = explode(' ',$title);
if ( count($words) > 15 ) {
$title = implode(' ',array_splice($words,0,15));
}
$title = str_replace('_','-',$title); $title = url_encode($title);
$str = $C->URL . $type . '/' . $id . '_' . $title ;
return $str ;
}
function makeseo($type,$id,$title) {
global $C ;
if ( $C->POST_SEO == 0 ) return $C->URL . $type . '/article' . $id . '.html' ;
if ( strlen($title) > 120 ) $title = substr($title,0,120) ;
$title = mb_ereg_replace('[^A-Za-z0-9آ-ی \_\-]+',' ',$title);
$title = str_replace("_","-",$title); $title = url_encode($title);
$str = $C->URL . $type . "/" . $id . "/" . $title . ".html" ;
//$str = $C->URL . $id . '_' . $title ; //. '.html'
return $str ;
}
میدونم مشکل سادست ولی هر کاری میکنم درست نمیشه
ممنون میشم راهنمائی کنید
تشکر بابت انجمن واقعا مشکلاتم خیلی زود برطرف شدن
من از یک سیستم استفاده میکنم که به صورت معمولی به این صورت پست هاش نمایش داده میشه
www.site.com/56985_نام-پست.html
این کدهاش در فایل function.php برای معرفی عنوان مطلب به اون شکل هست:
$str = $C->URL . $type . "/" . $id . "_" . $title . ".html" ;
من تغییرش دادم و به این صورت کردم :
$str = $C->URL . $type . "/" . $title . ".html" ;
پست ها لینکاشون در سایت درست میشه و به این شکل میشن :
www.site.com/نام-پست.html
اما به مطلب که میری خطای 404 میده و مطلب رو نمایش نمیده
ولی اگر مطلب را به صورت این شکلی وارد کنی کار میکنه و مطلب رو میاره
www.site.com/article197105.html
کدهای htaccess سایت هم اینه :
#AddDefaultCharset utf-8
#php_flag display_errors 0
#php_flag magic_quotes_gpc Off
Options +FollowSymlinks
RewriteEngine On
DirectoryIndex index.php index.html
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*) http://%1/$1 [L,R=302]
RewriteRule ^tags/(.+)/page/([0-9]+)/?$ index.php?act=search&tag=$1&page=$2 [QSA,NC,L]
RewriteRule ^tags/(.+)/?\.html$ index.php?act=search&tag=$1 [QSA,NC,L]
RewriteRule ^tags/(.+)/?$ index.php?act=search&tag=$1 [QSA,NC,L]
RewriteRule ^rss/([0-9]+)/(.+)/(.+)/?(\.xml)?$ rss.php?cat=$1 [QSA,NC,L]
RewriteRule ^rss/([0-9]+)/?(.+)?/?(\.xml)?$ rss.php?id=$1 [QSA,NC,L]
RewriteRule ^sitemap.xml/?$ sitemap.php [QSA,NC,L]
RewriteRule ^sitemap2.xml/?$ sitemap2.php [QSA,NC,L]
RewriteRule ^(.+)/([0-9]+)/(.+)/?\.html$ /$1/article$2.html [L,R=301]
RewriteRule ^([0-9]+)/(.+)/?\.html$ /post/article$1.html [L,R=301]
RewriteRule ^(.+)/([0-9]+)_(.+)/?$ /$1/article$2.html [L,R=301]
RewriteRule ^(.+)/article(.+)/?\.html$ index.php?act=$1&id=$2 [QSA,NC,L]
RewriteRule ^cat/([0-9]+)/page/([0-9]+)/?$ index.php?cat=$1&page=$2 [QSA,NC,L]
RewriteRule ^cat/([0-9]+)/(.+)/?\.php$ index.php?cat=$1 [QSA,NC,L]
RewriteRule ^subcat/(.+)/page/([0-9]+)/?$ index.php?catname=$1&page=$2 [QSA,NC,L]
#RewriteRule ^link\.php\?id=([0-9]+)/?$ index.php?id=$1 [QSA,NC,L]
## SubCat's
RewriteRule ^subcat/(.+)/(.+)/page/(.+)/?$ index.php?error=1&subcat=$1&catname=$2&page=$3 [QSA,NC,L]
RewriteRule ^subcat/(.+)/(.+)/?$ index.php?error=1&subcat=$1&catname=$2 [QSA,NC,L]
## SubCat's
## Cat's
RewriteRule ^cat/(.+)/page/(.+)/?$ index.php?error=1&subcat=$1&page=$2 [QSA,NC,L]
RewriteRule ^cat/(.+)/?$ index.php?error=1&subcat=$1 [QSA,NC,L]
## Cat's
RewriteCond %{REQUEST_FILENAME} "!admin/(.*)"
RewriteCond %{REQUEST_FILENAME} "!google(.*)"
RewriteRule ^(.+)/?\.html$ index.php?catname=$1 [QSA,NC,L]
RewriteRule ^page/(.+).php$ index.php?act=page&page=$1 [QSA,NC,L]
## Search ##
#RewriteRule ^items/(.+)/?\.html$ index.php?act=search&tag=$1 [QSA,NC,L]
#RewriteRule ^search/(.+)/?\.html$ index.php?act=search&tag=$1 [QSA,NC,L]
RewriteRule ^(.+)/([0-9]+)/(.+)/?\.html$ index.php?act=$1&id=$2&name=$3 [QSA,NC,L]
RewriteRule ^(.+)/([0-9]+)/?\.html$ index.php?act=$1&id=$2 [QSA,NC,L]
RewriteRule ^(.+)/([0-9]+)_(.+)/?$ index.php?id=$2&title=$3 [QSA,NC,L]
RewriteRule ^([0-9]+)_(.+)/?$ index.php?id=$1&title=$2 [QSA,NC,L]
#RewriteRule ^([0-9]+)_(.+)/?$ index.php?tag=$2 [QSA,NC,L]
RewriteRule ^(.+)/(.+)/page/([0-9]+)/?$ index.php?$1=$2&page=$3 [QSA,NC,L]
RewriteRule ^(.+)?/?page/([0-9]+)/?$ index.php?act=$1&page=$2 [QSA,NC,L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule \.(gif|jpe?g|png|bmp) /userfiles/nopic.jpg [NC,L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^(.+) index.php?error=404 [NC,L]
#AddOutputFilterByType DEFLATE text/html text/plain text/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
# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
<FilesMatch ".*$">
ErrorDocument 404 /index.php?error=404
ErrorDocument 400 /index.php?error=400
ErrorDocument 500 /index.php?error=500
</FilesMatch>
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl|jpg|png|gif)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
AddType application/octet-stream mp3
AddType application/octet-stream mp4
AddType application/octet-stream 3gp
AddType application/octet-stream mpg
AddType application/octet-stream mpeg
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=864000, public"
</FilesMatch>
<FilesMatch ".(xml|txt)$">
Header set Cache-Control "max-age=3600, public, must-revalidate"
</FilesMatch>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
<LimitExcept POST GET>
</LimitExcept>
کد کامل قسمت فانکشن هم اینه :
function make_seo($type,$id,$title) {
global $C ;
if ( $C->POST_SEO == 0 ) return 'http://' . $type . '.' . $C->DOMAIN . '/' . $type . '/article' . $id . '.html' ;
if ( $C->POST_SEO == 0 ) return $C->URL . $type . '/article' . $id . '.html' ;
$title = mb_ereg_replace('[^A-Za-z0-9آ-ی \_\-]+',' ',$title);
$words = explode(' ',$title);
if ( count($words) > 15 ) {
$title = implode(' ',array_splice($words,0,15));
}
$title = str_replace('_','-',$title); $title = url_encode($title);
$str = $C->URL . $type . '/' . $id . '_' . $title ;
return $str ;
}
function makeseo($type,$id,$title) {
global $C ;
if ( $C->POST_SEO == 0 ) return $C->URL . $type . '/article' . $id . '.html' ;
if ( strlen($title) > 120 ) $title = substr($title,0,120) ;
$title = mb_ereg_replace('[^A-Za-z0-9آ-ی \_\-]+',' ',$title);
$title = str_replace("_","-",$title); $title = url_encode($title);
$str = $C->URL . $type . "/" . $id . "/" . $title . ".html" ;
//$str = $C->URL . $id . '_' . $title ; //. '.html'
return $str ;
}
میدونم مشکل سادست ولی هر کاری میکنم درست نمیشه
ممنون میشم راهنمائی کنید