我有一个域,该域具有用于api和托管js等的自定义网址,但是,它也有一个wordpress网站,漂亮的网址无法正常工作。我必须指定当前页面,即使手动将它们添加到htaccess文件中,也没有任何文章。我想念什么?
我尝试过基于url结构的规则,并以与其他一些url相同的方式直接链接。
Options -indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ /errors/404.php [L]
RewriteCond %{REQUEST_URI} ^/500/$
RewriteRule ^(.*)$ /errors/500.php [L]
#RewriteCond %{HTTPS} off
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(api-inc)($|/) - [L]
# Rewrite all other URLs to index.php/URL
#RewriteRule ^(.*)$ index.php?/$1 [L]
# WORDPRESS PAGES
RewriteRule ^copy-paste-code/?$ ?page_id=1372 [L,QSA]
RewriteRule ^intergrations/?$ ?page_id=1373 [L,QSA]
RewriteRule ^support/?$ ?page_id=1374 [L,QSA]
RewriteRule ^news/?$ ?page_id=5 [L,QSA]
#tix url 1 parameter -
RewriteRule ^tix/([^/\.]+)/?$ api-inc/tix/card.php?c=$1 [L,QSA]
#cart url 3 parameter -
RewriteRule ^cart/([^/\.]+)/([^/\.]+)/?$ api-inc/cart/index.php?api=$1&key=$2 [L,QSA]
RewriteRule ^bootstrap-css/?$ api-inc/cart/bootstrap/css/bootstrap.min.css [L,QSA]
#button url 1 parameter -
RewriteRule ^button-sales-css/?$ api-inc/button/ntix-button.css [L,QSA]
RewriteRule ^button-sales-js/?$ api-inc/button/ntix-sale-001.js [L,QSA]
RewriteRule ^ntix-modal/?$ api-inc/button/ntix-modal.js [L,QSA]
RewriteRule ^script-sales/?$ api-inc/script/sales.js [L,QSA]
RewriteRule ^script-fp/?$ api-inc/script/fingerprint.js [L,QSA]
RewriteRule ^script-fp-core/?$ api-inc/script/fingerprintjs2/fingerprint2.js [L,QSA]
#api url 3 parameter - api key, type of call, item id
RewriteRule ^api/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ api.php?key=$1&t=$2&i=$3 [L,QSA]
# RewriteRule ^(.*)$ api.php?key=$1&t=$2&i=$3 [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
所以关键的事情是 1. api调用正在按预期方式使用重写 2. WordPress可以按预期工作 3.可以使用自定义网址访问链接的js和样式表