Mod Rewrite 不适用于我的插件域

发布于 2024-09-26 01:01:59 字数 944 浏览 1 评论 0原文

我的主域上有一个 WordPress 网站。对于 Wordpress 网站,我的 .htaccess 文件中有此内容:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>

# END WordPress

我刚刚创建了一个插件域并想为其使用新规则。我创建了一个 .htaccess 文件并将其放入插件文件夹中,例如。 /newaddon

.htaccess 文件中,我有:

Options -Indexes

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^readjob/(.*)/(.*)/(.*)/$ readjob.php?id=$1&amp;cat=$2&amp;title=$3
</IfModule>

我的 URL 结构是这样的:

http://www.website.com/readjob/3/jobs/web-designers-potech-integrated-services/

但它一直告诉我该链接是破碎的。我不知道该怎么办,请帮助我。我今天刚刚学会了模组重写,所以清晰度将受到高度赞赏。

I have a Wordpress website on my main domain. For the Wordpress website, I have this in my .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>

# END WordPress

I just created an addon domain and wanted to use new rules for it. I created a .htaccess file and put it inside the addon folder, eg. /newaddon.

In the .htaccess file I have:

Options -Indexes

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^readjob/(.*)/(.*)/(.*)/$ readjob.php?id=$1&cat=$2&title=$3
</IfModule>

The URL stucture I have is this:

http://www.website.com/readjob/3/jobs/web-designers-potech-integrated-services/

But it keeps telling me that the link is broken. I don't know what to do, please I need assistance. I just learnt mod rewriting today, so clarity will be highly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

从此见与不见 2024-10-03 01:01:59

我相信这就是您所寻找的:

选项 -Multiviews

我在我的主域下托管的域的根目录中使用它,在我的情况下,它们恰好有两层深度。

RewriteBase 上的Options +FollowSymlinks

Options -Multiviews

RewriteEngine

/

澄清您将 Options -Multiviews 添加到插件网站 htaccess 文件。 :D

I believe this is what your looking for:

Options -Multiviews

I use this in my root directory of domains hosted under my main domain and in my case they happen to be two levels deep.

i.e.

Options +FollowSymlinks

Options -Multiviews

RewriteEngine on

RewriteBase /

to clarify you add Options -Multiviews to the addon websites htaccess file. :D

狂之美人 2024-10-03 01:01:59

这不是 HTML,其中 & 应该用字符引用表示(除非用作引用开放分隔符)。因此:

RewriteRule ^readjob/(.*)/(.*)/(.*)/$ readjob.php?id=$1&cat=$2&title=$3

此外,您应该使用比 .* 更具体的模式,例如 [^/]+

RewriteRule ^readjob/([^/]+)/([^/]+)/([^/]+)/$ readjob.php?id=$1&cat=$2&title=$3

This is not HTML where the & should be represented with a character reference (except if used as a reference open delimiter). So:

RewriteRule ^readjob/(.*)/(.*)/(.*)/$ readjob.php?id=$1&cat=$2&title=$3

Furthermore, you should use a more specific pattern than .* like [^/]+:

RewriteRule ^readjob/([^/]+)/([^/]+)/([^/]+)/$ readjob.php?id=$1&cat=$2&title=$3
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文