user1537415
user1537415

Reputation:

.htaccess rewrite isn't working

As I'm developing a site with Roots & Wordpress, Roots will rewrite wp-content/themes/themename/assets/etc to assets/etcbut it's not working. .htaccess contains this on the bottom:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^assets/css/(.*) /wp-content/themes/retlehs-roots-e3f7365/assets/css/$1 [QSA,L]
RewriteRule ^assets/js/(.*) /wp-content/themes/retlehs-roots-e3f7365/assets/js/$1 [QSA,L]
RewriteRule ^assets/img/(.*) /wp-content/themes/retlehs-roots-e3f7365/assets/img/$1 [QSA,L]
RewriteRule ^plugins/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

It looks fine to me? But it's not working, so is this a problem with my server or the file itself?

Upvotes: 3

Views: 1355

Answers (1)

Gerben
Gerben

Reputation: 16825

Looking at the comments it seems you installed WP in a subfolder. If so the RewriteBase should reflect this.

So it should be RewriteBase /subfolder. Also you should remove the / in front of /wp-content...

So all together:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subfolder
RewriteRule ^index\.php$ - [L]
RewriteRule ^assets/css/(.*) wp-content/themes/retlehs-roots-e3f7365/assets/css/$1 [QSA,L]
RewriteRule ^assets/js/(.*) wp-content/themes/retlehs-roots-e3f7365/assets/js/$1 [QSA,L]
RewriteRule ^assets/img/(.*) wp-content/themes/retlehs-roots-e3f7365/assets/img/$1 [QSA,L]
RewriteRule ^plugins/(.*) wp-content/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Upvotes: 2

Related Questions