English 中文(简体)
htaccess redirect
原标题:htaccess redirection

我曾试图利用“htaccess”来寻找解决办法,将下列ur改:

<><>从下载

mydomain.com/my-short-list/1AXC7682 or mydomain.com/my-short-list/1AXC7682/

<>>

mydomain.com/my-short-list/?u=1AXC7682

<><>从下载

mydomain.com/user-reviews/42 or mydomain.com/user-reviews/42/

<>>

mydomain.com/user-reviews/?urid=42 

最后:

<><>从下载

mydomain.com/videos/1055687406001/130433/bmw-i8-concept-sports-car-in-detail or  
mydomain.com/videos/1055687406001/130433/bmw-i8-concept-sports-car-in-detail/

<>>

mydomain.com/videos/?vid=1055687406001&pid=130433&url=bmw-i8-concept-sports-car-in-detail

谢谢!

问题回答

1. 增订本

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^my-short-list/([0-9]{1}[a-z0-9]{7})/?$ /my-short-list/?u=$1 [NC,L]
RewriteRule ^user-reviews/([0-9]+)/?$ /user-reviews/?urid=$1 [NC,L]
RewriteRule ^videos/([0-9]+)/([0-9]+)/([a-z0-9-]+) /videos/?vid=$1&pid=$2&url=$3 [NC,L]

#wp default
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>

类似情况:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^my-short-list/ my-short-list/?u= [NC,L]
RewriteRule ^user-reviews/ user-reviews/?urid= [NC,L]
RewriteRule ^videos/([0-9]+)/([0-9]+)/(.*)$ videos/?vid=$1&pid=$2&url=$3 [NC,L]




相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...

热门标签