2017-10-04 104 views
0

我想我的网站(的Joomla)的单个URL重写一个友好的URL即改写.htaccess文件一perticular URL不是基于模式

www.example.com/index.php?option=com_mycomponent&view=article&id=10&nav_button=0&article_layout=1&Itemid=503

www.example.com/favourit

不干扰网站的其他网址

谢谢你的帮助。

+0

这个URL中的数据会改变吗?我的意思是,如果你直接将它重定向到'favorite',并且'itemid'改为504,那么它应该做什么? –

+0

网址不会改变,如果我输入'www.example.com/favourit',它应该显示在上面显示的冗长的URL –

+0

中显示的数据,然后下面的答案是正确的,就像它在你的htaccess中一样,并且/ favourit将起作用 –

回答

1

原题:

尝试

RewriteRule ^favourit$ /index.php?option=com_mycomponent&view=article&id=10&nav_button=0&article_layout=1&Itemid=503 [L] 

OP弹出一个子文件夹..

如果要移动网站直播,为example.com假定你已经生活,但你的评论表明你仍然在localhost工作,那么你应该。

放在根目录,多数民众赞成//mysite

RewriteRule ^mysite/favourit$ /mysite/index.php?option=com_mycomponent&view=article&id=10&nav_button=0&article_layout=1&Itemid=503 [L] 

这是暂时的,所以你并不需要修复,一旦你去住。

+0

是的,我已经尝试过,但出现错误, 未找到 未在此服务器上找到请求的URL/mysite/favourit。 Apache/2.4.9(Win64)PHP/5.5.12服务器在本地主机端口80 –

+0

所以它的'/ mysite'前缀是?然后使用RewriteRule^mysite/favourit $ ... –

+0

'http:// localhost/mysite /'这是我的本地站点的主目录,这就是我想要访问的友好URL'http:// localhost/mysite/favourit',我已经试过这个'^ mysite/favourit $'但仍然是同一个问题 –