değil dosya ya da yönlendirmek için htaccess yazma kuralı

0 Cevap php

Ben aşağıdaki yapacaktır Htaccess bir dizi kural yazmaya çalışıyorlar:

  • With the url: mydomain.com/blog/something

    • If a file called blog.php exists in
      the web directory(the directory with index.php in) then redirect to
      blog.php?url=something

    • If blog.php does not exist, redirect to index.php?url=blog/something

    • EDIT: mydomain.com/blog/something is an example, it could be any url string and the htaccess should search the web directory for a file corresponding to the first part of the url string, which in this case is "blog"

Her iki durumda da o zaman benim php komut ne olursa olsun eylemleri intiate için url parametreleri almak için $ _GET ['url'] kullanabilirsiniz.

Şu anda var:

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([^/]*)/(.*)$ $1.php?url=$2 [L]
RewriteRule ^(.*)$ index.php?url=$1 [L]

</IfModule>

Ama ne yazık ki bu neden, ben php ile yeterince yetkin değilim ama benim htaccess becerileri oldukça sınırlı emin değilim, çalışmıyor. [L] seçeneğini daha fazla seçenekler kullanılarak olmalıdır eğer ben kullanırken veya gereken biri olup olmadığını bilmiyorum. Şu anda ne olursa olsun url dizesi, $ _GET ['url'] olan "index.php" döndürür.

Daha fazla bilgi gerekiyorsa, sadece isteyin.

I hope someone can help Regards Luke

0 Cevap