我有一个wordpress网站,以及该服务器上已从wordpress中排除的子目录。这是我在.htaccess文件中用来排除该目录的行:
RewriteCond %{REQUEST_URI} !(app) [NC]
我在该目录中有一个表单。只要其中一个字段包含URL,我就会在提交时获得wordpress 404。如果该字段不包含URL,则它会正常提交。我该如何解决这个问题?
编辑:
这是我尝试过的:
以下是wordpress .htaccess的全文:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !(app) [NC]
RewriteRule ^other/(.*) /wp-includes/$1 [QSA,L]
RewriteRule ^file/(.*) /wp-content/uploads/$1 [QSA,L]
RewriteRule ^ext/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteRule ^skin/main\.css //index.php?style_wrapper=1 [QSA,L]
RewriteRule ^skin/(.*) /wp-content/themes/sirens/$1 [QSA,L]
RewriteRule ^ajax /wp-admin/admin-ajax.php [QSA,L]
RewriteRule ^wp-content/themes/sirens/screenshot\.png|readme\.html|license\.txt|wp-content/debug\.log|wp-includes/$ /nothing_404_404 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<Files 403.shtml>
order allow,deny
allow from all
</Files>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</ifModule>
以下是表格:
<form enctype="application/x-www-form-urlencoded" class="form-horizontal" method="post">
<textarea id = "orders" name = "orders"></textarea>
<input type="submit" value="Place order" class=" btn btn-blue">
</form>
在每种情况下,结果都是相同的 - 它在字段中没有URL,但在字段中有URL时会转到wordpress 404页面。
示例:
答案 0 :(得分:0)
您要将规则添加到哪个.htaccess文件中?默认的Wordpress .htaccess,还是在您的子目录中?
也许在子目录中使用以下内容创建.htaccess文件会有所帮助:
<IfModule mod_rewrite.c>
RewriteEngine off
</IfModule>
答案 1 :(得分:0)
尝试使用以下代码...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory-name/
....
其他将是相同的
它可能对你有所帮助..
此致 Nimesh P。