2014-11-03 79 views
0

我尝试了几乎所有的东西,但是我做错了什么。我想我的网址更改来自:.htaccess - 如何删除部分网址?

http://website.com/component/products/product1?Itemid=101

http://website.com/product1

我的.htaccess:

RewriteEngine On 

RewriteRule ^component/easydiscuss/(.*)$ $1 [L,QSA] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php?/$1 [L] 

# RewriteBase/

## Begin - Joomla! core SEF Section. 
# 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
RewriteRule .* index.php [L] 

请帮 谢谢

+0

您是否也可以提供不同的产品链接?我不太确定那个Itemid = 101在那里做了什么。 – 2014-11-03 14:56:30

+0

其他产品网址看起来类似: http://website.com/component/products/product2?Itemid=101 如果我手动删除?Itemid = 101 url仍然有效。 – Frostbourn 2014-11-03 22:43:26

回答

2

试试这个在你的.ht访问文件(将此代码放在开头):

RewriteEngine ON 
RewriteRule ^component/products/(.*)$ $1 [L,QSA] 

您可以检查http://htaccess.madewithlove.be/ .htaccess文件。

此代码执行您的请求:将http://website.com/component/products/product1?Itemid=101改写为http://website.com/product1

如果这不起作用,请解释什么是工作,什么不是。此外,测试http://website.com/product1是否正在工作

+0

这dosnt工作。 – Frostbourn 2014-11-04 14:36:34

+0

我删除了“0”并将您的代码放在正确的位置,但没有任何更改。 – Frostbourn 2014-11-04 14:45:21

+0

是的,我删除了逗号。你可以在第一篇文章中看到我目前的htaccess。 – Frostbourn 2014-11-04 14:57:50