与.htacces奇怪的反应友好的URL形成我的网络托管...帮助 [英] Friendly URLs with .htacces weird response form my web hosting... HELP

查看:91
本文介绍了与.htacces奇怪的反应友好的URL形成我的网络托管...帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想,当这个插入的网址:

I just wanted that when this is inserted in the URL:

http://website.com/pelicula/0221889/
http://website.com/pelicula/0221889/posters/

这真的进入这个(背景):

It really goes to this (in background):

http://website.com/index.php?ctrl=pelicula&id=0160399
http://website.com/index.php?ctrl=pelicula&id=0160399&tab=posters

所以我把这个在我的.htaccess文件:

So I put this in my .htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^/([^/]+)/([^/]+)/?([^/]*)/?$ index.php?ctrl=$1&id=$2&tab=$3 [QSA,L]
</IfModule>

但它不是我的虚拟主机工作,所以我问他们的支持团队的帮助,这是他们的反​​应:

But it was not working in my web host so I asked for help from their support team and this was their response:

<IfModule mod_rewrite.c>
RewriteEngine On
# If subdomain www exists, remove it first
#RewriteCond %{HTTP_HOST} ^www.([^.]+.[^.]+)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# If requested resource does not exist as a file
RewriteCond %{REQUEST_FILENAME} !-f
# and does not end with a period followed by a filetype
RewriteCond %{REQUEST_URI} !..+$
# and does not end with a slash
RewriteCond %{REQUEST_URI} !/$
# then add a trailing slash and redirect
RewriteRule (.*) $1/ [R=301,L]
</IfModule>

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

# END WordPress

显然,它不工作根据需要,所以我只是想知道如何解决这个问题!我不知道任何关于mod_rewrite的,我真的需要这个工作完美......我要疯了,我不知道哪里出了问题..请帮助!

Obviously its not working as desired so I just want to know how to fix this!!! I don't know nothing about mod_rewrite and I really need this to work perfectly... I'm going mad I don't know where is the problem.. please help!

推荐答案

这似乎支持家伙刚才送你的第一个URL重写code他们在知识库中作为样本。而这是正常的:世界上没有一个托管服务可以提供免费的咨询服务:)

It seems that the support guys just sent you the first URL-rewriting code they found in their knowledge base to serve as sample. And it's normal: no hosting service in the world can provide free consulting services :)

我建议你尽量保持简单:

I suggest you try to keep it simple:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/(\d+)/([^/]+)/?$ index.php?ctrl=$1&id=$2&tab=$3 [QSA,L]
    RewriteRule ^([^/]+)/(\d+)/?$         index.php?ctrl=$1&id=$2 [QSA,L]
    RewriteRule ^([^/]+)/?$               index.php?ctrl=$1 [QSA,L]
</IfModule>

这篇关于与.htacces奇怪的反应友好的URL形成我的网络托管...帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆