大网数据广告活动
网站运营与故障问答

Mod Rewrite: HTACCESS How to rewrite a single URL to another?

· 52CE 我爱测

I have read through a ton of other similar questions and have tried too many combinations of code, but nothing works. I just need to add a single rewrite (not redirect) to my htaccess: Here is the deal... I have this current URL:…

问题原文

原帖链接 · Bryan Earl · CC BY-SA 3.0

I have read through a ton of other similar questions and have tried too many combinations of code, but nothing works. I just need to add a single rewrite (not redirect) to my htaccess:

Here is the deal... I have this current URL:

https://example.com/all-categories/202/showCategory/54-Floor-Plans

and I want it to display as:

https://example.com/floor-plans

I still need it to actually be going to the original URL in the background to pull data, but display it differently in the browser URL.

Here is one of the options I tried (didn't work):

RewriteRule ^floor-plans$ all-categories/202/showCategory/54-Floor-Plans [L]

It is probably something extremely simple... HELP PLEASE!

已采纳解答

原帖链接 · Matthew Asia · CC BY-SA 3.0

I believe your problem is you're rewriting to a file that doesn't exist.

You'll need to find the non-rewritten URL.

For example:

RewriteRule ^floor-plans$ index.php?option=com_content&view=article&id=54

To find this you could try turning off Search Engine Friendly (SEF) URL's, open the page and check the URL.

You can also read more about SEF URL's here if you wish. https://docs.joomla.org/Search_Engine_Friendly_URLs

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2017-02-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。