.htaccess rewriteRule不起作用(example.com/?lang=en&p=help)

时间:2016-06-14 21:25:45

标签: apache .htaccess mod-rewrite url-rewriting

我的.htaccess有问题。

我的网址看起来像这样: example.com/?lang=en&p=help 第一部分工作: www.example.com/?lang=en&p=help 但第二部分没有。 它应该看起来像www.example.com/en/help或 它应该看起来像www.example.com/en/help.html(我试过两个)

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteRule ^([^/]*)/([^/]*)\.html$ /?lang=$1&p=$2 [L]

1 个答案:

答案 0 :(得分:0)

使用此:

MySerializableClass myObject;
// Construct an instance of the XmlSerializer with the type
// of object that is being deserialized.
XmlSerializer mySerializer = 
new XmlSerializer(typeof(MySerializableClass));
// To read the file, create a FileStream.
FileStream myFileStream = 
new FileStream("myFileName.xml", FileMode.Open);
// Call the Deserialize method and cast to the object type.
myObject = (MySerializableClass) mySerializer.Deserialize(myFileStream);

这会使您的网址从RewriteEngine On RewriteRule ^([^/]*)/([^/]*)\.html$ /?lang=$1&p=$2 [L] 变为www.example.com/?lang=en&p=help