簡體   English   中英

.htaccess文件沒有重定向 - 指導通緝

[英].htaccess file not redirecting - guidance wanted

我有這個網址:

<a href="drive_to_london/?procid=12">details</a>

網址變為地址欄:

http://web228.sydney.webhoster.ag/soputnik/drive_to_london/?procid=12

但我想在details.php處理邏輯。

如何在后台處理details.php中的數據並將第一個URL保留在地址中?

我試過這個:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^drive_to_(.*)$   http://web228.sydney.webhoster.ag/soputnik/details.php [R=301,L]

但它不工作,錯誤的是:NOT FOUND

請幫忙

如果您不想更改URL,那么它不是重定向,只是重寫。

更改:

RewriteRule ^/test/drive_to_(.*)$   /test/details.php [R=301,L]

對於這樣的事情:

RewriteRule ^/test/drive_to_(.*)$   /test/details.php?city=$1 [L]

用這個代替你的代碼:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^test/drive_to_(.*?)/?$ /test/details.php [L,NC]
  1. 別忘了將任何url params傳遞給details.php。

    Rewriterule ^/drive_for_(.*)/\\?(.*)$ http://domain.de/test/details.php/?$1 [R=301,L]

  2. 你想要傳遞城市名稱似乎是相關的,否則在重寫中上下文會丟失。 如果這是另一個url參數,你可以將它傳遞給details.php

    Rewriterule ^/drive_for_(.*)/\\?(.*)$ http://domain.de/test/details.php/?$2&city=$1 [R=301,L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM