第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

僅使用 Htaccess 刪除指定 URL 的子文件夾 [Codeigniter]

僅使用 Htaccess 刪除指定 URL 的子文件夾 [Codeigniter]

PHP
慕碼人2483693 2022-01-14 18:05:48
我的文件夾結(jié)構(gòu)根域assets/ (包含 css, images, js 文件夾)子文件夾/(包含內(nèi)部的 Codeigniter 項(xiàng)目和單獨(dú)的 .htaccess)索引.php聯(lián)系人.php.htaccess根 HtaccessOptions +FollowSymLinksRewriteEngine onRewriteCond %{REQUEST_URI} !(.*)subfolderRewriteRule ^(.*)$ subfolder/$1 [L]子文件夾(Codeigniter 項(xiàng)目)HtaccessDirectoryIndex index.php index.html<IfModule mod_rewrite.c>RewriteEngine OnRewriteCond $1 !^(index\.php|assets|install|update)RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d# For godady Shared Hosting Server uncomment the line belowRewriteRule ^(.*)$ index.php?/$1 [L]</IfModule>子文件夾 URL 列表http://example.com/subfolder/products/http://example.com/subfolder/product/product-slug-123根 URL 列表http://example.com/index.phphttp://example.com/contact.php在我的 Codeigniter 項(xiàng)目中,我將Products控制器設(shè)置為default_controller. 所以問題是,當(dāng)我嘗試訪問根文件夾中的 index.php 頁面時(shí),它只將 Codeigniter 產(chǎn)品列表顯示為主頁。我需要以下網(wǎng)址:http://example.com/index.phphttp://example.com/contact.phphttp://example.com/products/http://example.com/product/product-slug-123任何帶有 htaccess 或代碼的解決方案?
查看完整描述

1 回答

?
ITMISS

TA貢獻(xiàn)1871條經(jīng)驗(yàn) 獲得超8個(gè)贊

最后我得到了這個(gè)工作。


RewriteCond %{REQUEST_URI} !((.*)subfolder|^/assets) // to Exclude this

RewriteCond %{REQUEST_URI} (^/products(.*)|^/product(.*)) // to Include this

RewriteRule ^(.*)$ subfolder/$1 [L]

感嘆號(?。┓栍糜凇安弧逼ヅ涞木W(wǎng)址。


所以我刪除了感嘆號并使用另一個(gè) RewriteCond (條件)僅當(dāng) url 包含段 asproducts或product http://example.com/products/或http://example.com/product/product-slug-123時(shí)才重定向。它現(xiàn)在工作得很好。我想,分享這個(gè)對某人有用??鞓肪幋a。


查看完整回答
反對 回復(fù) 2022-01-14
  • 1 回答
  • 0 關(guān)注
  • 145 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號