重写.htaccess中的动态网址?

时间:2015-08-01 15:54:22

标签: php html apache .htaccess mod-rewrite

这是一个示例网址。 97006是查询字符串。 Customer-Manager是一个为每个页面更改的标题。 单击按钮时会运行jobdetails.php,这会将您带到如下所示的页面。

http://11.11.111.111/97006/Customer-Manager.html

我希望网址为: http://11.11.111.111/job/Customer-Manager.html

在.htaccess中,已经有我要更改的网址的代码。

我认为这是规则的条件:(因为它是第一条件和第一条规则,它是如何工作的?)

RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]

这是我尝试改变多次但没有成功的规则: RewriteRule ^([1-9][0-9]*)/([-.,_0-9a-zA-z]*)\.html$ job_details.php?query_string=$1&action=%1 [L]

此代码在按钮时生成网址:

$button = tep_href_link($id.'/'.$title.'.html');

我有研究apache指令,正则表达式并尝试过许多教程,但每当我在该行的htaccess中更改任何内容时,我都会被发送到错误的网址或网站崩溃。

1 个答案:

答案 0 :(得分:1)

我认为您无法使用此网址:

http://example.com/jobs/97006/data.html

#example