如何删除动态&来自url的静态文件夹名称,使用htaccess
example.com/theme/dynamicfolder /
到
example.com /
主题是静态目录& dynamicfolder 是来自mysql数据库的值
我目前的htaccess脚本
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\. [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule ^ https://%1%{REQUEST_URI} [NE,L,R=301]
# external redirect to redirect old URL to pretty URL
RewriteCond %{THE_REQUEST} /a\.php\?slug=([^\s&]+) [NC]
RewriteRule ^ /article/%1? [R=301,L,NE]
RewriteCond %{THE_REQUEST} /sitemap\.php [NC]
RewriteRule ^ /sitemap.xml [R=301,L,NE]
RewriteCond %{THE_REQUEST} /contact\.php [NC]
RewriteRule ^ /contact [R=301,L,NE]
# internal rewrite to forward to actual URL
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^article/([\w-]+)/?$ a.php?slug=$1 [L,QSA]
RewriteRule ^sitemap\.xml$ sitemap.php [L]
RewriteRule ^contact$ contact.php [L]
答案 0 :(得分:0)
根目录中当前.htaccess
文件的末尾。
添加以下内容:
printList :: List -> String
printList (Node v n) = show v ++ ' ' : printList n
printList Empty = "_"
所以网址:
<强> https://yourdomain.tld/staticFolder/anotherFolder/any0therValue 强>
可以从以下网址访问:
<强> https://yourdomain.tld/any0therValue 强>
但在这种情况下,应预先定义 anotherFolder 。