2010-06-23 5 views
0

.htaccess으로 내 라우팅 시스템을 만들고 싶지만 몇 가지 문제가 있습니다..htaccess routing

내 폴더 구조는 다음과 같습니다

htaccess로
| - 시스템
| - 컨트롤러
| - 테마
| - domain.dk
| --- gfx
| --- 스타일
| --- html

.htaccess을 어떻게 만듭니 까? 라우팅도 사용 하시겠습니까?

.htaccess은 다음과 같습니다 내 : 나는 지난 5 개 라인을 주석 처리를 제거

RewriteEngine On 

php_value zlib.output_compression 16386 

RewriteCond %{HTTP_HOST} ^www\.(.*) 
RewriteRule (.*) http://%1/$1 [R=301,L] 


RewriteRule ^api/(.*)?$   /system/api/$1 
RewriteRule ^image/(.*)?$  /theme/%{HTTP_HOST}/gfx/$1 
RewriteRule ^data/(.*)?$  /theme/%{HTTP_HOST}/data/$1 
RewriteRule ^style/(.*)?$  /theme/%{HTTP_HOST}/include/$1 
RewriteRule ^javascript/(.*)?$  /theme/%{HTTP_HOST}/include/$1 
RewriteRule ^files/(.*)?$  /theme/%{HTTP_HOST}/files/$1 

# Sitemap & robot building 
RewriteRule ^xml-sitemap  /system/sitemap.php 
RewriteRule ^sitemap.xml  /system/sitemap.php 
RewriteRule ^robots.txt   /theme/%{HTTP_HOST}/data/robot.txt 

# Selecetet lang 
RewriteRule ^l-([a-z]+)/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)?$ /system/index.php?modul=$2&title=$3&lang=$1 
RewriteRule ^l-([a-z]+)/([a-zA-Z0-9\-_]+)?$  /system/cms.php?tag=$2&lang=$1 

# Bilinfo - modul 
# RewriteRule ^mBiler?$   /system/index.php?modul=bilinfo&method=cars 
# RewriteRule ^mBiler/ck([0-9]+)\-([a-zA-Z0-9\-_]+)?$ /system/index.php?modul=bilinfo&method=car_single_view&id=$1&title=$2 
# RewriteRule ^mBiler/c([0-9]+)\-([a-zA-Z0-9\-_]+)?$ /system/index.php?modul=bilinfo&method=cars_list_view&id=$1&title=$2 

# Customer modul rewirte here 
RewriteRule ^customer-page?$   /system/index.php?modul=customer&method=login_screen 
RewriteRule ^customer-option?$   /system/index.php?modul=customer&method=customer_option 
RewriteRule ^customer-view-invoice/([a-zA-Z0-9\-_]+)?$ /system/index.php?modul=customer&method=view_single_invoice&guid=$1 
RewriteRule ^invoice-cancel/([a-zA-Z0-9\-_]+)?$  /system/index.php?modul=customer&method=cancel_invoice&guid=$1 
RewriteRule ^customer-main?$   /system/index.php?modul=customer&method=customer_main 
RewriteRule ^customer-lose-password?$  /system/index.php?modul=customer&method=lose_password 
RewriteRule ^customer-logout?$   /system/index.php?modul=customer&method=customer_logout 

# Etrade modul rewirte here 
RewriteRule ^shopping-cart?$   /system/index.php?modul=etrade&method=shopping_cart 
RewriteRule ^cart-remove-product/([a-zA-Z0-9]+)?$ /system/index.php?modul=etrade&method=remove_product_from_shopping_cart&cartid=$1 
RewriteRule ^shopping-cart-customer?$  /system/index.php?modul=etrade&method=shopping_cart_customer 
RewriteRule ^shopping-cart-done?$  /system/index.php?modul=etrade&method=shopping_cart_done 
RewriteRule ^cat([0-9,]+)/([a-zA-Z0-9\-_]+)?$  /system/index.php?modul=etrade&method=category_product_list&id=$1&title=$2 
RewriteRule ^cat([0-9,]+)/([a-zA-Z0-9\-_]+)/sort-([a-zA-Z0-9\-_]+)?$ /system/index.php?modul=etrade&method=category_product_list&id=$1&title=$2&sort=$3 
RewriteRule ^product([0-9]+)/([a-zA-Z0-9\-_]+)?$ /system/index.php?modul=etrade&method=product_view&id=$1&title=$2 
RewriteRule ^product_search?$   /system/index.php?modul=etrade&method=search_product 

# Gateway payment 
RewriteRule ^gateway/status/([a-zA-Z0-9\-_]+)?$  /system/index.php?modul=gateway&method=status&customer_guid=$1 
RewriteRule ^gateway/callback/([a-zA-Z0-9\-_]+)?$ /system/index.php?modul=gateway&method=callback&customer_guid=$1 

# Actions 
RewriteRule ^actions/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)?$ /system/actions.php?modul=$1&method=$2 

# Defualt lang 
RewriteRule ^([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)/t-([0-9]+)-([a-zA-Z0-9\-_]+)?$ /system/index.php?modul=$1&method=$2&id=$3tag=$4 
RewriteRule ^([a-zA-Z0-9\-_]+)/t-([0-9]+)-([a-zA-Z0-9\-_]+)?$ /system/index.php?modul=$1&id=$2tag=$3 
RewriteRule ^bl([0-9]+)-([a-zA-Z0-9\-_]+)?$  /system/blog_view.php?blog_id=$1 
RewriteRule ^gl([0-9]+)-([a-zA-Z0-9\-_]+)?$  /system/gallery_view.php?blog_id=$1 

RewriteRule ^([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)?$  /system/index.php?modul=$1&method=$2 
RewriteRule ^pre\-([a-zA-Z0-9\-_]+)?$  /system/cms.php?tag=$1&preview=true 
RewriteRule ^([a-zA-Z0-9\-_]+)?$   /system/cms.php?tag=$1 

# Test .htaccess stuff. 
# RewriteCond $1 !^(index\.php|robots\.txt|images|css|js) 
# RewriteCond %{REQUEST_FILENAME} !-f 
# RewriteCond %{REQUEST_FILENAME} !-d 
# RewriteRule ^(.*)/$ index.php [L] 

난 정말 내가 예를 들어, 멀리이 문제를 얻을 수있는 방법을 모르기 때문에 gfx, 스타일 등. 사용자가 gfx의 긴 URL을 알지 못하게하려면 theme/domain.dk/gfx/images.png; 그들은 내가 필요 gfx/images.png

+0

로 볼 필요가; 다음을 유지하는 사람이라면 누구보다 나쁘다고 생각합니다. –

답변

0
RewriteEngine On 

php_value zlib.output_compression 16386 

RewriteCond %{HTTP_HOST} ^www\.(.*) 
RewriteRule (.*) http://%1/$1 [R=301,L] 

# Test .htaccess stuff. 
RewriteRule ^image/(.*)?$        /theme/%{HTTP_HOST}/gfx/$1 [L] 
RewriteRule ^api/(.*)?$         /system/api/$1 [L] 
RewriteRule ^data/(.*)?$        /theme/%{HTTP_HOST}/data/$1 [L] 
RewriteRule ^javascript/(.*)?$       /theme/%{HTTP_HOST}/include/$1 [L] 
RewriteRule ^files/(.*)?$        /theme/%{HTTP_HOST}/files/$1 [L] 
RewriteRule ^style/(.*)?$        /theme/%{HTTP_HOST}/include/$1 [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php [L] 

그것의 내 대답 : 오류가 너무 코드에있는 맞춤법 @contagious