【发布时间】:2018-12-23 08:13:33
【问题描述】:
我在这里搜索并尝试所有解决方案,但没有一种解决方案适合我。
在我的域根目录的 Public_html 文件夹中,我安装了 WordPress。现在,在 Public_html 的目录中,我创建了一个子目录并将其命名为 app。之后我上传了一个 PHP 脚本,但我的脚本没有给我完整的路径。而且我的 URL 不会从 app 子目录加载 CSS、JS 和图像文件。
这些是我的网站 URL 链接。
Main Page
http://example.com
http://example.com/index.php
Single Video Pages
http://example.com/watch/tlb2UbRcuME
http://example.com/watch/ps2lXZegtBM
http://example.com/watch/D7cJn2Sy6FU
Search Pages
http://example.com/search/Learn+PHP
http://example.com/search/New+VEVO
http://example.com/search/New+songs
Images and Images folder Paths
http://example.com/img/logo.png
http://example.com/imgages/php.png
JavaScripts and CSS folder Paths
http://example.com/js/player.js
http://example.com/js/mini.js
http://example.com/css/style.css
http://example.com/css/player.css
Other Single Pages
http://example.com/contact
http://example.com/privacy
http://example.com/dmca
(1) 现在,我想更改目录或文件夹。
我想通过APP子目录或子文件夹访问以上所有链接。 我的意思是我想在域 URL 之后添加名为 APP 的子目录。
我想在域后的 URL 链接中添加目录或文件夹名称。 目录名是APP或者app
例如...我希望首先是所有 URL 链接和所有其他链接应该是 像这样的访问...
Main Page
http://example.com/app
http://example.com/app/index.php
Single Video Pages
http://example.com/app/watch/tlb2UbRcuME
http://example.com/app/watch/ps2lXZegtBM
http://example.com/app/watch/D7cJn2Sy6FU
Search Pages
http://example.com/app/search/Learn+PHP
http://example.com/app/search/New+VEVO
http://example.com/app/search/New+songs
Images and Images folder Paths
http://example.com/app/img/logo.png
http://example.com/app/imgages/php.png
JavaScripts and CSS folder Paths
http://example.com/app/js/player.js
http://example.com/app/js/mini.js
http://example.com/app/css/style.css
http://example.com/app/css/player.css
Other Single Pages
http://example.com/app/contact
http://example.com/app/privacy
http://example.com/app/dmca
(2) 我还想访问所有 HTTP WWW URL 使用 HTTPS 非 WWW URL。
例如:
http://www.example.com/app/dmca
进入
https://example.com/app/dmca
以上以及所有其他带有 HTTPS 非 WWW URL 的 URL。
什么 .htaccess 文件代码将用于上述情况。 有没有针对上述问题的解决方案或建议。
那是我的 .htaccess 文件。
RewriteEngine On
RewriteBase /
# RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^search/(.+)$ /search.php?q=$1
RewriteRule ^search/([^/]*?)/page/([^/]*?)/$ /search.php?q=$1&token=$2
RewriteRule ^search/([^/]*?)/$ /search.php?q=$1
RewriteRule ^download/([^/]*?)/page/([^/]*?)/$ /search.php?q=$1&token=$2
RewriteRule ^download/([^/]*?)/$ /search.php?q=$1
RewriteRule ^watch/(.+)$ /watch.php?id=$1 [L]
RewriteRule ^home/(.+)$ /index.php?q=&page=$1 [L]
RewriteRule ^(cache/|submit\.php|head\.php|head_mobile\.php|foot\.php|foot_mobile\.php|includes\.php|config\.php) - [F,L,NC]
RewriteRule ^sitemap.xml$ /sitemap.php [L]
RewriteRule ^dmca$ /dmca.php
RewriteRule ^privacy$ /privacy.php
RewriteRule ^contact$ /contact.php
ErrorDocument 404 /index.php
【问题讨论】:
-
你能发布你尝试过的东西吗?