的.htaccess URL重写友好的问题:有错误时,文件和文件夹的名称是相同的 [英] .htaccess url friendly rewrite issue: having errors when files and folder names are same

查看:99
本文介绍了的.htaccess URL重写友好的问题:有错误时,文件和文件夹的名称是相同的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,我想实现搜索引擎友好的改写与一个.htaccess文件

I have a site where I am trying to implement SEO friendly rewrite with an .htaccess file

我的网站具有以下文件夹结构:

My site have the following folder structure:

- root/
    - corporativo/
        - [more stuff...]
    - social/
        - [more stuff...]
    - index.php
    - corporativo.php
    - social.php

index.php文件处理我所有的网站功能和路由。我使用GET变量'cuerpo确定部分,即例如,用于我使用的index.php社会部分?cuerpo =社会。

index.php handles all my sites functionality and routing. I am using GET variable 'cuerpo' to determine the section i.e. for example for social section I am using index.php?cuerpo=social.

一个我发现的问题是,有社会DIR和social.php是相互矛盾的姓名和与改写的条件。

One of the problems I found is that having social dir and social.php are conflicting with names and with the rewrite conditions.

请说明正确的方式来处理这种情况。

Please suggest the right way to handle this situation.

非常感谢你! 顺祝商祺!

Thank you very much! Best Regards!

推荐答案

的.htaccess 文件,重写规则才可以使用这两个条件 -

In a .htaccess file, before rewrite rules one can use these two conditions -

RewriteCond %{REQUEST_FILENAME} !-f  # Not an actual file
RewriteCond %{REQUEST_FILENAME} !-d  # Not an actual directory

他们决定了下面的规则将只适用于如果请求的文件名或文件夹是不存在的。它是用来使一个浏览器将仍然能够访问资源他们无需进行路由。

They dictate that the following rule will only apply if the requested filename or folder doesn't really exist. It is used so that a browser will still be able to access resources without them having to be routed.

<子>我不是100%肯定这是你的问题,但。更可能的是一个问题,在你的路由的index.php

这篇关于的.htaccess URL重写友好的问题:有错误时,文件和文件夹的名称是相同的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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