2015-05-15 17 views
0

從這個:清洗URL使用的.htaccess

crunchpaper.com/jlpt/form/try_question.php 

這樣:

crunchpaper.com/jlpt/try_question/ 

我試試這個:

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^try_question$ /try_question.php/$1 [NC,QSA] 

但它不工作。

我想清理上面的URL。

請幫幫我。由於

回答

1

這個規則應該工作:

RewriteRule ^jlpt/form/try_question\.php$ jlpt/try_question/ [L] 
+0

如果需要此規則爲多個URL的工作,請告訴我,我會更新我的答案。 –

+0

非常感謝您的回覆。我會嘗試。 –

+0

這不起作用。請檢查我的代碼有什麼問題: –

0
RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^jlpt/form/try_question\.php$ jlpt/try_question/ [L] 

on /var/www/crunchpaper/jlpt 


<Files ~ "^\.ht"> 
deny from all 
</Files> 
Options -Indexes 

# ErrorPage 
ErrorDocument 400 crunchpaper.com/ 
ErrorDocument 403 https://crunchpaper.com/ 
ErrorDocument 404 https://crunchpaper.com/ 
ErrorDocument 405 https://crunchpaper.com/ 


# DefaultPage 
DirectoryIndex index.php index.html 

Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^crunchpaper.com\.com$ 
RewriteRule ^(.*)$ https://crunchpaper.com/$1 [R=301,L] 

on /var/www/crunchpaper 

Can you tell me what is wrong