简体   繁体   中英

.htaccess RewriteCond

Can anyone halp me with this .htaccess file, i've been trying to make an exception so i can access my subdomain which is form.domain.com i tried with RewriteCond %{REQUEST_URI} !^/form/?$ and several other commands but with no luck

.htaccess :

#######################
#   N - T H I N G !   #
#######################

# Apache options
Options +FollowSymLinks -Indexes
RewriteEngine on

# Allow only GET and POST verbs
RewriteCond %{REQUEST_METHOD} !^(GET|POST)$ [NC,OR]

# Ban Typical Vulnerability Scanners and others
# Kick out Script Kiddies
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(libwww-perl|curl|wget|python|nikto|wkito|pikto|scan|acunetix).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner).* [NC,OR]

# Error Page
ErrorDocument 404 /404

# Redirect attachments
RewriteRule ^files/attachments/(.*)/(.*)/(.*)$ files/attachments/$1/$2/$3 [L]

# Redirect all requests to index.php
RewriteRule ^(.*)$ index.php [L,QSA]

To match a domain you should use %{HTTP_HOST} as in:

RewriteCond %{HTTP_HOST} ^form.domain.com$
RewriteRule ^.*$ - [L]

That says if the domain matches form.domain.com, allow the URL and stop processing rules.

See the Apache documentation for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM