2014-04-12 5 views
1

(으)로 바꾸어주세요. 제발 쉽게 들리지만, htaccess를 다시 작성하면됩니다.htaccess를 % 20 (을)를 -

% 20을 (를) URL (으)로 바꾸려고합니다. 나는 알아낼 수 없다.

다음 htaccess 코드에서 나에게 무슨 문제가 있다고 말할 수 있습니까? URL 재 작성 부분에서만

# Begin hotlink protection # 
RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^http://webawwards.com/.*$ [NC] 
RewriteCond %{HTTP_REFERER} !^http://www.webawwards.com/.*$ [NC] 
RewriteCond %{HTTP_REFERER} !^http://webawwardscom.ipage.com/.*$ [NC] 
RewriteCond %{HTTP_REFERER} !^http://www.webawwardscom.ipage.com/.*$ [NC] 
RewriteRule .(gif|jpg|png)$ - [F] 
# End hotlink protection # 


# Begin cache control # 
ExpiresActive on 
ExpiresDefault "now plus 240 minutes" 
ExpiresByType text/html "now plus 240 minutes" 
<FilesMatch "\.(css|png|bmp|ico|htm|gff|html|js|jpg|jpeg|gif|gcf)$"> 
FileETag MTime Size 
ExpiresDefault "now plus 240 minutes" 
</FilesMatch> 


# End cache control # 

# Url rewritting start # 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^\.]+)$ $1.php [NC,L] 
RewriteCond %{HTTP_HOST} ^webawwards\.com [NC] 
RewriteRule (.*) http://www.webawwards.com/$1 [L,R=301] 

# remove spaces from start or after/
RewriteRule ^(.*/|)[\s%20]+(.+)$ $1$2 [L] 

# remove spaces from end or before/
RewriteRule ^(.+?)[\s%20]+(/.*|)$ $1$2 [L] 

# replace spaces by - in between 
RewriteRule ^([^\s%20]*)(?:\s|%20)+(.*)$ $1-$2 [L,R] 

# Url rewrite end # 


# Enable gzip compression 
<ifModule mod_gzip.c> 
mod_gzip_on Yes 
mod_gzip_dechunk Yes 
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ 
mod_gzip_item_include handler ^cgi-script$ 
mod_gzip_item_include mime ^text/.* 
mod_gzip_item_include mime ^application/x-javascript.* 
mod_gzip_item_exclude mime ^image/.* 
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* 
</ifModule> 

작동하지 않는 것 같습니다.

내가 www.domain.com/blog/post.php?title=text%headline 위의 코드가 잘못 내가 아는 www.domain.com/blog/title-headline

로 대체하고 싶지만

+0

중복 가능성에 다시 작성됩니다 시도 어디 있는지 알아낼 질수 % 20을 (를) 사용하여 모든 URL을 리디렉션합니다. (http://stackoverflow.com/questions/19797848/htaccess-redirect-all-urls-using-20-to) –

+0

이미 시도했습니다. 나를 위해 일하지 않았어. – TonyS

+0

"text % headline"- 아마도 "text % 20headline"입니까? – user4035

답변

1

title에 공백이 포함 된 경우이 대신

RewriteCond %{THE_REQUEST} ^(GET|POST)\ /blog/post\.php\?title=(.*)%20(.*)\ HTTP 
RewriteRule^/blog/%2-%3? [R=301,L] 

그래서, 그것은 [htaccess로의 -