我想修改以下动态网址到SEF网址: http://sampleurl.com/en/movie-details.php?id=1001
网址:网址应如下所示: http://sampleurl.com/movie/id-1001/
请帮助我.....这是我的代码......我正在使用godaddy服务器
Options -MultiViews
## Mod_rewrite in use.
RewriteEngine On
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* movie-details.php [F]
#RewriteBase /
RewriteCond %{REQUEST_URI} !^/movie-details\.php
RewriteRule .* /en/movie-details.php?id=$1 [L]
# Removes index.php from URLs
RewriteCond %{THE_REQUEST} ^GET.*movie-details\.php [NC]
RewriteCond %{REQUEST_URI} !/en/.* [NC]
RewriteRule (.*?)movie-details\.php/*(.*) /$1$2 [R=301,NE,L]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /movie-details.php/$1 [L]
答案 0 :(得分:1)
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^movie/id-([0-9]+)/$ /movie-details.php?id=$1 [QSA,L]