想要隐藏页面.html通过修改 htAccess 在 URL 的末尾


want to hide page.html in the end of the url by modifying htaccess

>有人可以帮我在htaccess中重定向网址吗? 就像在其显示页面下方的链接中一样.html最后,我不想出现,是否可以通过更改 HTaccess,在许多 URL 中也显示了很多内容,我也想将其更改为/或任何其他字符以适当地看起来。

http://www.domain.com/98-three-wheelers/listings.html
http://www.domain.com/63-we-are-currently-looking-for-customer-care-executive-for-a-call-center-in-ahmedabad/details.html

我正在使用的HT访问如下:

RewriteRule ^index.html index.php [nc]
RewriteRule ^recent_ads.html recent_ads.php [nc]
RewriteRule ^register.html register.php [nc]
RewriteRule ^pre-register.html pre-register.php [nc]
RewriteRule ^login.html login.php [nc]
RewriteRule ^logout.html logout.php [nc]
RewriteRule ^favorites.html favorites.php [nc]
RewriteRule ^contact.html contact.php [nc]
RewriteRule ^listings.html listings.php [nc]
RewriteRule ^pre-submit.html pre-submit.php [nc]
RewriteRule ^refine.html refine.php [nc]
RewriteRule ^([0-9]+)-([^'/]+)?/content.html$ content.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/index.html$ index.php?category=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/details.html$ details.php?id=$1 [nc,qsa]
RewriteRule ^([^'/]+)/([^'/]+)/([^'/]+)/recent_ads.html$ recent_ads.php?page=$1&order=$2&order_way=$3 [nc,qsa]
RewriteRule ^([^'/]+)/recent_ads.html$ recent_ads.php?page=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/user_listings.html$ user_listings.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/contact_details.html$ contact_details.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/([^'/]+)/([^'/]+)/([^'/]+)/user_listings.html$ user_listings.php?id=$1&page=$3&order=$4&order_way=$5 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)/([^'/]+)/user_listings.html$ user_listings.php?id=$1&page=$3 [nc,qsa]
RewriteRule ^([^'/]+)/([^'/]+)/([^'/]+)/favorites.html$ favorites.php?page=$1&order=$2&order_way=$3 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/store.html$ store.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/([^'/]+)/([^'/]+)/([^'/]+)/store.html$ store.php?id=$1&page=$3&order=$4&order_way=$5 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)/([^'/]+)/store.html$ store.php?id=$1&page=$3 [nc,qsa]

另请参阅下面的链接中,URL 中使用了太多的百分比百分比a,我可以在不更改 URL 动机的情况下将其更改为其他类似/的内容,是否可以单独在 HTaccess 中进行更改以实现这一切?

.com/147-apartments-for-rent/no_of_rooms-1%20BHK/area_sq_ft-SQFT%20Less%20than%20500/condition_vehicles-New/listings.html

假设这一切都用于构建 URL

{capture name=some_content assign=constructed_url}{$live_site}/listings.php?page=1{foreach from=$post_array key=k item=x name=construct_url}{if $x!='' && $k!=$v.depending.caption2 && $k!=$v.depending.caption3 && $k!=$v.depending.caption4 && $k!="page" && $k!="show" && (!$settings.enable_locations ||(!in_array($k, $location_fields( && $k!="crt_city"((}{$separator}{$k}={$x|replace:'/':'--'|urlencode}{assign var="separator" value="&"}{/if}{/foreach}{/capture}

代码中需要更改的内容。请不要介意我是编程领域的新手,刚刚开始学习这些东西......

你有这些规则

RewriteRule ^([0-9]+)-([^'/]+)?/content.html$ content.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/index.html$ index.php?category=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/details.html$ details.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/user_listings.html$ user_listings.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/contact_details.html$ contact_details.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^'/]+)?/store.html$ store.php?id=$1 [nc,qsa]

当您删除content.htmlindex.htmldetails.htmluser_listings.htmlcontact_details.htmlstore.html时,您将只有

RewriteRule ^([0-9]+)-([^'/]+)?/$ ... [nc,qsa]

你如何决定,正确的要求是什么?是content.html还是index.html,也许details.html.但它也可能是store.html.

所以,我不明白,如何删除listing.htmldetails.html等。

当您将

链接中的空格替换为其他内容时,您可以阻止 URL 中的%20。您必须查看创建URL的源代码(href=...src=...urlencode或其他一些URL创建函数(并使用str_replace例如

$url = str_replace(' ', '-', $url);

在回显<a href="$url">标记之前。