Salexes
Salexes

Reputation: 187

Add URL Rewrite Rule .htaccess

I've installed a Wordpress plugin that makes my website to a static one. The plugin is called "Simply Static".

Now I have a static version of my website here: http://example.com/wp-content/uploads/static/

But my visitors should not see the whole url, i want them just to see http://example.com or e.g.: http://example.com/contact/ instead of http://example.com/wp-content/uploads/static/contact/

However I can't seem to modify the htaccess to rewrite this.

I've tried:

RewriteEngine On
RewriteRule !^/ /wp-content/uploads/static/%{REQUEST_URI} [L,R=301]

Any ideas appreciated!

Upvotes: 2

Views: 214

Answers (1)

Olaf Dietsche
Olaf Dietsche

Reputation: 74018

To rewrite from / to /wp-content/uploads/static, you just use

RewriteRule !^wp-content/uploads/static /wp-content/uploads/static%{REQUEST_URI} [L]

Note the following

  • the pattern never starts with a slash in a directory context (e.g. .htaccess)
  • %{REQUEST_URI} already contains a leading slash
  • no R|redirect flag

Upvotes: 1

Related Questions