我想更改我的网址。 目前他们看起来像这样:
/* TEST DATA */
; WITH a AS (
SELECT 'A' AS thegroup, 'all' AS gender UNION ALL
SELECT 'A' AS thegroup, 'all' AS gender UNION ALL
SELECT 'A' AS thegroup, 'female' AS gender UNION ALL
SELECT 'B' AS thegroup, 'all' AS gender UNION ALL
SELECT 'C' AS thegroup, 'female' AS gender UNION ALL
SELECT 'C' AS thegroup, 'all' AS gender UNION ALL
SELECT 'D' AS thegroup, 'female' AS gender
)
/* THE QUERY */
SELECT b.*
FROM (
SELECT thegroup, gender, RANK() OVER (PARTITION BY thegroup ORDER BY gender) AS rn /* Sets the ranked groups of 'thegroup' */
FROM a
) b
WHERE b.rn = 1 /* Gets first group. */
AND thegroup = 'A'
我希望他们看起来像这样:
http://website.net/?page=news
http://website.net/?page=information&skin=217 (shows a mario skin with informations)
到目前为止我所做的是:
http://website.net/news/
http://website.net/mario/
^此代码适用于更改URL-Addresse,但我收到404错误:找不到页面。好像这样做不太好。
我想念的是什么,我需要改变什么? 这也必须使用给定的参数,所以:http://website.net/Mario/应该仍然知道参数page = information,skin = 217
由于
答案 0 :(得分:1)
您可以在站点根目录中使用此代码.htaccess:
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/+\?page=information&skin=217\s [NC]
RewriteRule ^ /mario/? [R=301,L]
RewriteCond %{THE_REQUEST} \s/+\?page=([^\s&]+)\s [NC]
RewriteRule ^ /%1/? [R=301,L,NE]
RewriteRule ^mario/?$ /?page=information&skin=217 [L,QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ /?page=$1 [L,QSA]
答案 1 :(得分:0)
`RewriteCond %{THE_REQUEST} \s/+\?page=information&skin=([^\s&]+)\s [NC]
RewriteRule ^ /%1/? [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ /?page=information&skin=$1 [L,QSA]
RewriteCond %{THE_REQUEST} \s/+\?page=information&resourcepack=([^\s&]+)\s [NC]
RewriteRule ^ /%1/? [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ /?page=information&resourcepack=$1 [L,QSA]`
我现在有这个,适用于所有皮肤,但不适用于资源包。为什么呢?
还尝试将第二个博客中的%1和$ 1更改为%2和$ 2.