godaddy htaccess 文件有问题

Having trouble with godaddy htaccess file

RewriteEngine On

RewriteBase /
RewriteRule ^/?$ /1 [L]


<IfModule mod_rewrite.c>
Options -MultiViews                
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^sayfa-([0-9a-zA-Z-_]+)  menu-detay.php?sef= [L,QSA]
RewriteRule ^kategori-([0-9a-zA-Z-_]+)  kategoriler.php?sef= [L,QSA]
RewriteRule ^urun-([0-9a-zA-Z-_]+)-([0-9]+)$  urun-detay.php?sef=&urun_id= [L,QSA]
RewriteRule ^urun-([0-9a-zA-Z-_]+)  urun-detay.php?sef= [L,QSA]
RewriteRule ^bize-ulasin$ iletisim.php [NC,L]
RewriteRule ^sitemap.xml$ sitemap.php [NC,L]
</IfModule>

这是我的 htaccess 文件,seo links 不工作。我正在使用 LINUX 主机,找不到任何有用的东西。

当我在我的索引上点击我的 seo url 时,例如“网站。com/product-33v-new-generation”,它会将我重定向到主页。

RewriteRule ^urun-([0-9a-zA-Z-_]+)-([0-9]+)$ urun-detay.php?sef=&urun_id= [L,QSA]

这是我的 seo url link 产品

RewriteRule ^kategori-([0-9a-zA-Z-_]+)  kategoriler.php?sef= [L,QSA]

这是一个类别。

但他们中没有一个以某种方式工作。我有另一个 linux 主机,但它们工作正常。

任何帮助appericiated。

使用您显示的示例,请尝试遵循 htaccess 规则。请确保在测试您的 URL 之前清除您的浏览器缓存。

RewriteEngine On

RewriteBase /
RewriteRule ^/?$ index.php [L]   

<IfModule mod_rewrite.c>
Options -MultiViews                
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
##RewriteRule ^(.*)/?$ index.php [L]
RewriteRule ^ index.php [L]

RewriteRule ^sayfa-([0-9a-zA-Z-_]+)  menu-detay.php?sef= [NC,L,QSA]
RewriteRule ^kategori-([0-9a-zA-Z-_]+)  kategoriler.php?sef= [NC,L,QSA]
RewriteRule ^urun-([0-9a-zA-Z-_]+)-([0-9]+)$  urun-detay.php?sef=&urun_id= [NC,L,QSA]
RewriteRule ^urun-([0-9a-zA-Z-_]+)  urun-detay.php?sef= [L,QSA]
RewriteRule ^bize-ulasin/?$ iletisim.php [NC,L]
RewriteRule ^sitemap\.xml/?$ sitemap.php [NC,L]
</IfModule>

OP 尝试的 htaccess 规则文件中的一些修复:

  • 您无需根据所示尝试使用多个 <IfModule mod_rewrite.c> 部分。
  • 不需要使用多个RewriteBase,可以在Rules的开头提到
  • 还修复了此处其他一些规则中的一些规则标志和正则表达式。