codeigniter-htaccess 相关问题


.htaccess 将参数重写为路径

我想用htaccess重写参数到路径。 例子: https://test.link?test123 -> https://test.link/test123 该网站使用 PHP 8.0 运行。 我的 .htaccess 中有以下代码...


CodeIgniter 帮助程序未加载

我试图使用这个助手创建一个国家/地区下拉列表。(https://github.com/EllisLab/CodeIgniter/wiki/helper-dropdown-country-code) 我创建了一个名为country_helper.php 的文件,其中包含 h...


.htaccess 域名始终带有 www

我从我的主 .htaccess 文件中的另一篇文章中获取了此代码: RewriteCond %{HTTPS} 已关闭 RewriteCond %{REQUEST_URI} !^.*/sensors/.*$ 重写规则 ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} ...


使用 Codeigniter 将 url 更改为破折号而不是下划线

嗨,我正在使用 codeigniter 框架,因为它在 MVC 方面真的很酷。我有一个关于 url 的问题。通常在保存控制器时,让我们在“关于我们”页面中说我...


Codeigniter 3 登录代码在本地主机上运行良好,但在域中部署时无法运行

我启动了一个使用 codeigniter 3 构建的网站,并进行了配置更改,例如基本 url、数据库等。这是错误: 遇到 PHP 错误 严重性:警告 消息:Undefi...


在 codeigniter 中启用 cors(restserver by @chriskacerguis)

http.get 请求工作正常。 当 api 移动到服务器时,出现了问题。 客户端使用 angularJs $http.get('http://example.com...


Codeigniter 模型扩展了 CI_MODEL

我想在 core 文件夹中创建 2 个不同的模型扩展 CI_Model, 例如: 类 MY_FirsModel 扩展 CI_Model { } 类 MY_SecondModel 扩展 CI_Model { } 使用时可以吗


.htaccess WordPress 站点中的分页重定向规则

人们! 我想将网址从“https://some-domain.com/.../?product-page=some-page-number”更改为“https://some-domain.com/.../page” /some-page-number" 使每个动态 p...


mod_rewrite到子目录中相应的php文件

我想使用 mod_rewrite (在 .htaccess 中)将“干净”的 URL 映射到子目录中相应的 php 文件,例如: https://example.com/test/ --> https://example.com/p/test.php 我的...


Codeigniter 将 CSV 上传到数据库

提前感谢您给我的帮助,我会解释我的情况。 基于教程 文件上传 论坛:只是一个不错的 csv 上传和填充数据库功能 表单创建插入...


drupal 7 和 git - 仅更新站点文件

我正在使用 git 更新我的 d7 网站。我只想添加 /sites 文件夹和 .htaccess 我想并保留所有核心 drupal 文件。有办法做到这一点吗?


使用 .htaccess 删除 .html 和 .php 扩展名

如何从网页中删除文件类型,而不创建新目录并将文件命名为index.php。我希望将 http://example.com/google.html 更改为 http://example.com/google。 我该怎么去…


.htaccess 将主域重定向到子目录无法访问文件问题

访问主域“example.com”时,它应该从子文件夹加载文件,因为我无法编辑主域根文档。 结构: 公共_html 子文件夹 索引.php


如何使用.htaccess将两个域指向目录和子目录

我有两个域名 www.domain1.com 和 www.domain2.com 在同一主机根目录及其子目录中都有文件。如何将 www.domain1.com 指向 [root] 并将 www.domain2.com 指向其子目录


根据条件自定义错误文档,可能与否?

好吧 - 我大脑的逻辑与 .htaccess 文件中的代码如何处理的逻辑相去甚远……很糟糕,因为有时当你试图实现一些“逻辑”的东西时,它会变得令人沮丧。 我...


修改现有的.htaccess,使其忽略子域

我有以下 .htaccess 文件,虽然我知道它远非最佳(并且可能有点令人畏惧) - 它只是有效。 # 防止公众查看 .htaccess 文件 我有以下 .htaccess 文件,虽然我知道它远非最佳(而且可能有点令人难受) - 它只是有效。 # Prevents public viewing of .htaccess file <Files .htaccess> order allow,deny deny from all </Files> # Custom 404 page ErrorDocument 404 https://www.domain.com/404/ # Turn on rewriting and set rewriting base RewriteEngine On RewriteBase / # Force WWW RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} ^([^.]+)\.([a-z]{2,4})$ [NC] RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=302,L] # Force WWW and HTTPS RewriteCond %{HTTP_HOST} !^www\. [NC,OR] RewriteCond %{HTTPS} off RewriteRule ^ https://www.domain.com%{REQUEST_URI} [R=301,L] # Remove .php extension RewriteRule ^(properties)/(all|location1|location2|location3)/(all|1|2|3|4|5|6|7|8|9)/(asc|desc) $1.php?location=$2&bedrooms=$3&sort-by=$4 RewriteRule ^(properties)/(all|location1|location2|location3)/(all|1|2|3|4|5|6|7|8|9) $1.php?location=$2&bedrooms=$3 RewriteRule ^(properties)/(all|location1|location2|location3) $1.php?location=$2 RewriteRule ^(view-property)/(.*)/(print-view) $1.php?id=$2&print=true RewriteRule ^(view-property)/(.*)/ $1.php?id=$2 RewriteRule ^(.*)/$ $1.php 我们的新网站现已准备好推送到我们新创建的临时环境中进行测试。在本例中,它会是 staging.domain.com,但我们在实际访问此暂存 URL 时遇到问题。 编辑 - 只是为了澄清,问题是访问 staging.domain.com 重定向到 https://www.domain.com。 我们认为问题是由我们上面的重写规则引起的。我研究了一些可能的解决方案,包括向现有重写规则添加附加条件,例如: RewriteCond %{HTTP_HOST} !^staging\.domain\.com 或添加新的条件/规则,例如: RewriteCond %{HTTP_HOST} ^staging\.domain\.com [NC] RewriteRule ^(.*) - [L] 但不幸的是这些都不起作用。使用 .htaccess 文件确实不是我的强项,所以如果有人可以提供任何帮助,那就太好了。 附注新网站由 Laravel 5.3 提供支持,因此当我们上线时,我将摆脱重写规则(位于底部的规则)的可怕尝试! 您的顶级规则必须更改为此以删除目标 URL 中的硬编码域名: # Turn on rewriting and set rewriting base RewriteEngine On RewriteBase / # Force WWW and HTTPS RewriteCond %{HTTP_HOST} !^www\. [NC,OR] RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L,NE] # Remove .php extension and rest of the rewrite rules Crypto.com 登录问题 已经是 crypto.com 登录用户?继续作为 crypto.com 登录问题用户。或者。电子邮件。密码。登录 忘记密码?没有帐户?立即注册。注册 Crypto.com NFT 帐户 · 连接您经过验证的 crypto.com 登录问题 · 提交申请成为创建者 Trezor suite 应用程序 移动版 Trezor Suite Lite 是一款免费应用程序,可让您同步和跟踪所有比特币和加密货币您手机上的帐户。适用于 Trezor 硬件钱包的新桌面和浏览器应用程序。 Trezor Suite 在可用性、安全性和隐私这三个关键支柱上带来了重大改进。


替换字符串后在 echo 中运行额外的 php 代码

我想在替换表单中的一些字符串后执行附加的php代码 这是我在 form.php 上的表单代码 我想在替换表单中的一些字符串后执行附加的php代码 这里是我在 form.php 上的表单代码 <form method="post" action="result.php"> <input type="text" name="yourtext"> <input type="submit"> </form> 例如文本是 my name is bagu and i live under a rock thanks 这里是 result.php 代码 <?php $mytext = $_POST['yourtext']; $find = ["my name is","and i live", "thanks"]; $replace = ["<?php open_form('Form/insert') ?><input name='name' type='text' value='","'><br><input name='address' type='text' value='","'><input type='submit'><?php form_close() ?>"]; $intoform = str_replace($find, $replace, $mytext); echo $intoform; ?> 我想要的结果是“bagu”和“under a rock”分别在一个正在工作的文本框中 但问题是 echo 中的 php 代码不起作用(我认为???因为它是) 是的,这是 codeigniter 的表格 谢谢 ====== 编辑:我尝试了没有 echo 和变量的 result.php ,也就是我在 form.php 中提交文本后想要的结果 <?php open_form('Form/insert') ?> <input name='name' type='text' value='bagu'><br> <input name='address' type='text' value='under a rock'> <input type='submit'> <?php form_close() ?> 并且如果“ 使用 preg_match 提取姓名和地址。 die 子句仅用于指示输入字符串格式错误,可以根据需要替换为更友好的提示。 preg_match('/my name is (.+) and i live (.+) thanks/', $mytext, $m) or die('Input text is invalid'); 如果preg_match成功,$m[1]将包含名称,$m[2]将包含地址,然后您可以将值插入表单 <?php open_form('Form/insert') ?> <input name='name' type='text' value='<?=$m[1]?>'><br> <input name='address' type='text' value='<?=$m[2]?>'> <input type='submit'> <?php form_close() ?> 需要补充的是,在实际操作中,应检查用户输入的姓名和地址的合法性。例如,要限制它们仅包含字母和空格,第一步中的正则表达式 (.+) 可以更改为 ([A-Za-z ]+)。


在 HTML 文档中嵌入 TypeScript 代码

是否可以在网页中嵌入 TypeScript 代码?我想将 TypeScript 代码嵌入到脚本标签中,如下所示(以便它自动编译为 Javascript): <p>是否可以在网页中嵌入 TypeScript 代码?我想将 TypeScript 代码嵌入到脚本标签中,如下所示(以便它自动编译为 Javascript):</p> <pre><code>&lt;script type = &#34;text/typescript&#34;&gt; //TypeScript code goes here &lt;/script&gt; </code></pre> </question> <answer tick="true" vote="28"> <p>实际上有几个项目允许您使用类似的 TypeScript 代码 - <a href="https://github.com/niutech/typescript-compile" rel="noreferrer">TypeScript Compile</a>、<a href="https://github.com/ComFreek/ts-htaccess" rel="noreferrer">ts-htaccess</a>。</p> <p>这里的问题是 .ts 代码应该编译成 JavaScript - 它可以在客户端完成(速度慢;整个 TSC 也应该加载到客户端)或在服务器端完成(显然更快,而且它更快)在编译代码上利用缓存要容易得多)。</p> </answer> <answer tick="false" vote="18"> <p>这是我编写的版本,<strong>直接</strong>使用 Microsoft/TypeScript/master 的版本,因此它始终保持最新:<a href="https://github.com/basarat/typescript-script" rel="noreferrer">https://github.com/basarat/typescript-script</a></p> <p>您甚至可以将 <pre><code>ts</code></pre> 指向您可能拥有的任何其他 TypeScript 版本,它会正常工作 🌹</p> </answer> <answer tick="false" vote="6"> <p>已经为此目的开发了一个 JavaScript 库 - 它称为 <a href="https://github.com/niutech/typescript-compile" rel="noreferrer">TypeScript Compile</a>,它允许将 Typescript 嵌入到 HTML 中(如上所示。)</p> </answer> <answer tick="false" vote="0"> <p>我写这篇文章的目的是为了在浏览器中编译 TypeScript,以便我可以编写快速简单的示例来分享。</p> <p><a href="https://github.com/Sean-Bradley/text-typescript" rel="nofollow noreferrer">https://github.com/Sean-Bradley/text-typescript</a></p> <p>使用,</p> <pre><code>&lt;script type=&#34;text/typescript&#34;&gt; // Your TypeScript code here &lt;/script&gt; </code></pre> <p>并包含依赖项。</p> <pre><code>&lt;script src=&#34;https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" data-cfemail="67131e17021404150e1713275249544954">[email protected]</a>&#34;&gt;&lt;/script&gt; &lt;script defer src=&#34;https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" data-cfemail="3743524f431a434e47524454455e4743770619041907">[email protected]</a>&#34;&gt;&lt;/script&gt; </code></pre> <p>一个完整的示例,您可以复制/粘贴到 HTML 文档中并在本地尝试。</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang=&#34;en&#34;&gt; &lt;head&gt; &lt;meta charset=&#34;utf-8&#34; /&gt; &lt;meta name=&#34;viewport&#34; content=&#34;width=device-width, initial-scale=1&#34; /&gt; &lt;title&gt;&#34;text/typescript&#34; example&lt;/title&gt; &lt;meta name=&#34;description&#34; content=&#34;Transpiling and executing TypeScript in the browser&#34; /&gt; &lt;style&gt; body { overflow: hidden; margin: 0px; font-size: 15vw; } &lt;/style&gt; &lt;script type=&#34;text/typescript&#34;&gt; function foo(bar: string) { return &#34;Hello &#34; + bar; } let baz = &#34;World!&#34;; document.getElementById(&#34;root&#34;).innerHTML = foo(baz); &lt;/script&gt; &lt;script src=&#34;https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" data-cfemail="13676a63766070617a636753263d203d20">[email protected]</a>&#34;&gt;&lt;/script&gt; &lt;script defer src=&#34;https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" data-cfemail="ec98899498c198959c899f8f9e859c98acddc2dfc2dc">[email protected]</a>&#34;&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id=&#34;root&#34;&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>你可以看到它在这里、现在、今天发挥作用。</p> <p><a href="https://editor.sbcode.net/f1f4b5a73ec40283d1ddb37bb1e71f7e4e31b487" rel="nofollow noreferrer">https://editor.sbcode.net/f1f4b5a73ec40283d1ddb37bb1e71f7e4e31b487</a></p> </answer> </body></html>


© www.soinside.com 2019 - 2024. All rights reserved.