New answers tagged htaccess
1
vote
.htaccess Wildcard Passthrough Redirect
RewriteRule ^(.*)$ https://example.com/%1 [L,R=302]
Currently, you are capturing the URL-path (ie. ^(.*)$) but not making use of this, so any requests for files are redirected back to the "...
0
votes
Accepted
Rules in .htaccess only if the requested URL is /wp-admin
I ended up with this solution. I think in my first try my regex was wrong.
<If "%{REQUEST_URI} =~ m#^/wp-admin/#">
</If>
<Else>
Header add Content-Security-Policy &...
2
votes
Hide subfolders in URL with .htaccess
This assumes you have already changed all the internal links on your site to be of the form /this/index.php (or /this/<something>?), ie. #3 in @Stephen's comment above.
For your specific example,...
2
votes
Rewrite three URL directories to corresponding PHP files and pass subdirectory as a parameter
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(download-file)/([^/]+)$ https://example.com/download-file?name=$2 [L]
By using an absolute URL (with scheme + hostname) in the substitution ...
3
votes
Rules in .htaccess only if the requested URL is /wp-admin
Try something like this instead:
<If "%{THE_REQUEST} !~ m#\s/wp-admin#">
Header add Content-Security-Policy "default-src 'self';"
Header add Content-Security-Policy "...
Top 50 recent answers are included
Related Tags
htaccess × 1618mod-rewrite × 398
redirects × 381
apache × 341
301-redirect × 247
url-rewriting × 187
seo × 156
wordpress × 129
php × 129
url × 93
apache2 × 92
https × 84
subdomain × 62
domains × 48
404 × 41
security × 33
web-hosting × 30
google-search-console × 27
no-www × 27
robots.txt × 26
cpanel × 26
web-crawlers × 25
html × 24
dns × 23
google × 18