2012-04-05 30 views
12

Dosya veya dizin mevcutsa, yeniden yazma kuralımı atlamak için htacess dosyamı ayarlamaya çalışıyorum ancak dosya mevcut olduğunda URL'yi farklı bir şeye değiştirir. Bunun neden olduğunu bilmiyorum.Dosya veya dizin varsa RewriteCond, kural veya dosya varsa

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f [OR] 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^project/([^/\.]+)/?$ index.php?view=project&project=$1 [L] 
RewriteRule ^for/content/ag index.php?view=opening&section=ag [L] 
RewriteRule ^for/content/bus index.php?view=opening&section=bus [L] 
RewriteRule ^for/content/fcs index.php?view=opening&section=fcs [L] 
RewriteRule ^for/content/market index.php?view=opening&section=market [L] 
RewriteRule ^for/content/trade index.php?view=opening&section=trade [L] 
RewriteRule ^for/content/teched index.php?view=opening&section=teched [L] 
RewriteRule ^for/content/([^/\.]+)/?$ index.php?view=content_area&section=$1 [L] 

dizin/proje/nti var, bir index.php dosyası ile: İşte benim htaccess dosyasıdır. Mywebsite.com/folder/project/nti adresi girildiğinde, mywebsite.com/folder/project/nti/?view=project & project = nti olarak değişir. Bunu, örnek sitenin bir alt klasörde bulunduğu bir test sunucusunda uygularım ancak uygulandığında kök web sunucusu klasöründe olacaktır.

Yardımlarınız için teşekkürler! Böyle

cevap

25

Kaldır ekstra [OR] ve sahip olduğunuz kodu:

# If the request is not for a valid directory 
RewriteCond %{REQUEST_FILENAME} !-d 
# If the request is not for a valid file 
RewriteCond %{REQUEST_FILENAME} !-f 
# If the request is not for a valid link 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule ^project/([^/.]+)/?$ index.php?view=project&project=$1 [L,NC,QSA] 
İlgili konular