小编Ste*_*lak的帖子

.htaccess RewriteRule在子目录中不起作用

我正在编写我的网站的新版本,我正试图让.htaccess正确地重写.我的新网站存储在这里:

www.example.com/storage/new/
Run Code Online (Sandbox Code Playgroud)

我需要重写这些URL:

www.example.com/storage/new/welcome/   -> index.php?action=welcome
www.example.com/storage/new/page/name/ -> index.php?action=page&url=name
www.example.com/storage/new/post/name/ -> index.php?action=post&url=name
Run Code Online (Sandbox Code Playgroud)

这是我的.htaccess文件:

RewriteEngine On

RewriteRule ^/welcome/$ index.php?action=welcome [L]
RewriteRule ^/page/([a-zA-Z0-9]+)/$ index.php?action=page&url=$1 [L]
RewriteRule ^/post/([a-zA-Z0-9]+)/$ index.php?action=post&url=$1 [L]
Run Code Online (Sandbox Code Playgroud)

但是,它不起作用; 所有结果都找不到404.我已经尝试了一切,甚至打字www.example.com/storage/new/代替^.我在服务器root(www.example.com)中有另一个.htaccess,如下所示:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
Run Code Online (Sandbox Code Playgroud)

我无法想象这会产生怎样的影响,www.example.com/storage/new/但你永远不会知道.谁能帮我这个?

.htaccess subdirectory

11
推荐指数
1
解决办法
2万
查看次数

HTML/CSS全高侧边栏

我在互联网上发现了很多关于这个问题的讨论和问题,然而,它们似乎都不符合我的情况,解决方案对某种情况非常具体.

我有一个header高度100px位于页面顶部的元素.我有一个div#sidebar向左浮动的元素,宽度为250px,最后一个div#main元素也向左浮动.

的高度html,body以及div#sidebar100%.

div#sidebar无论浏览器大小或内容大小如何,我的目标都是一直延伸到页面底部.显然,如果内容长于可查看的页面高度,它应该正常运行并超过页面的末尾,引入滚动条.

但是,就目前而言,似乎页面高度已计算为100% + 100px,即使没有内容可以div#sidebar推倒,也会引入滚动条.到目前为止,我发现没有可行的解决方案,或者我可能错过了它或搞砸了解决方案; 无论如何,我已经待了一个多小时了,我准备撕掉我的头发了.

是否有一种非JavaScript方法可以使其正常工作以阻止header添加的高度100%


这是我的HTML/CSS - 尽管我在上面列出了所有相关细节,但这应该有所帮助.

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>My Awesome Template!</title>
        <link href="./stylesheet.css" rel="stylesheet" />
    </head>
    <body>
        <header id="primary">
            <h1>My Awesome Template!</h1>
        </header>
        <div id="sidebar">
            <h1>Sidebar</h1>
        </div>
        <div id="main">
            <h1>Main</h1>
        </div>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

CSS:

html, body
{
    margin: 0;
    padding: 0; …
Run Code Online (Sandbox Code Playgroud)

html css height

11
推荐指数
2
解决办法
8万
查看次数

标签 统计

.htaccess ×1

css ×1

height ×1

html ×1

subdirectory ×1