Alper Aslan
Alper Aslan

Reputation: 47

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=$1 [L,QSA]
RewriteRule ^kategori-([0-9a-zA-Z-_]+)  kategoriler.php?sef=$1 [L,QSA]
RewriteRule ^urun-([0-9a-zA-Z-_]+)-([0-9]+)$  urun-detay.php?sef=$1&urun_id=$2 [L,QSA]
RewriteRule ^urun-([0-9a-zA-Z-_]+)  urun-detay.php?sef=$1 [L,QSA]
RewriteRule ^bize-ulasin$ iletisim.php [NC,L]
RewriteRule ^sitemap.xml$ sitemap.php [NC,L]
</IfModule>

This is my htaccess file and seo links are not working. Im using LINUX hosting and couldnt find anything helpfull.

When i click my seo url on my index like "website.com/product-33v-new-generation" it redirect me to homepage.

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

This is my seo url link for products

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

And this one is for categories.

But non of them are working for somehow. I have another linux hosting but they are working just fine.

Any help appericiated.

Upvotes: 1

Views: 74

Answers (1)

RavinderSingh13
RavinderSingh13

Reputation: 133640

With your shown samples, please try following htaccess Rules. Please make sure to clear your browser cache before testing your URLs.

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

Few fixes in OP's tried htaccess Rules file:

  • You need NOT to use multiple <IfModule mod_rewrite.c> sections as per your shown attempts.
  • Need not to use multiple RewriteBase, you could mention it in starting of Rules.
  • Also fixed few Rules flags and regex in few of the other rules here.

Upvotes: 1

Related Questions