Reputation: 547
I want to redirect all traffic request uri to homepage of my wordpress page. I try override default wordpress, but cant get this to work any one can help in this ?
I try following:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /wordpress/
RewriteBase /
<If "%{REQUEST_URI} != 'http://127.0.0.1/wordpress/'">
Redirect 301 / http://127.0.0.1/wordpress/
</if>
#RewriteRule (.*) http://127.0.0.1/wordpress/ [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
Upvotes: 1
Views: 231
Reputation: 785098
You can use this rule just below RewriteBase
line:
RewriteCond %{THE_REQUEST} \s/+wordpress/\S [NC]
RewriteRule .+ /wordpress/ [L,R=301]
Upvotes: 2