user9437856
user9437856

Reputation: 2388

Redirect all the pages to the single page using htaccess?

I am using WordPress and I have to redirect all the pages to the index.html page (I created in the root folder for temporary).

I tried the below code but it's redirecting only the home page.

Redirect 301 "index.html" "https://www.examle.com"

I tried

RewriteRule ^(.*)$ https://www.examle.com/$1 [R=permanent,L] //getting error(The page isn’t redirecting properly)

I tried the below code

RewriteCond %{REQUEST_URI} !/index.html$ 
RewriteCond %{REMOTE_HOST} !^00.00.00.00   //my ip
RewriteRule $ /index.html [R=302,L]

Any other solution to redirect all pages to index.html? I have more than 50 pages on my website. I want to redirect all on the index.html

Upvotes: 2

Views: 1014

Answers (1)

Ozgur Sar
Ozgur Sar

Reputation: 2204

You can overwrite your existing .htaccess file content with this. Please note that this code assumes that your wordpress is installed on the root directory.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteRule . /index.html [R=302,L]

Upvotes: 2

Related Questions