Nice search not working

So I created this issue.

The only plugins I have installed are the Askimet and WP Importer but both are deactivated.
I’ve tried putting a .htaccess file at the root of my WP and at the root of the theme.

After seeing c2itllc’s comment, I realised that I deliberately didn’t allow roots to change the permalink structure to %postname% since I shouldn’t change the permalink structure as the blog is already live (I’ll be adding a completely new theme). But I was wrong, the existing permalink structure is %postname%. So I tried changing the permalink structure to that locally but it causes the CSS & JS not to be loaded on the homepage and the links to posts to be broken. Just adding the .htaccess and saving the permalink structure as the default doesn’t fix the nice search either.

Any help would be great.

Ok, so I’m a little confused… you said that the existing permalink structure on the live site is %postname%, so you tried to change that locally but it causes CSS & JS not to be loaded. So obviously there is an issue with your local setup.

Did you move the database over and run a search-replace on it to change the URL’s from the live site to the local site? Or at least go into thewp_options table and change the siteurl and home options.

I don’t know how you have your web server set up locally, but you should try and make sure that the correct permalinks are working before trying the Nice Search. It relies on pretty permalinks, so if the default permalinks are being used locally, then Nice Search will have no affect…

Thanks. FYI, I’m new to WP but not to PHP, Bootstrap, LESS, etc. I’m using just both WAMP & MAMP for this.

No, I didn’t alter the DB after importing the data. To replicate the live site, I need to set the permalinks to %postname% and then what? Are you saying the DB contains absolute URLs? I don’t get how it would’ve worked at all up to now if that was the case.

Yeah, that’s what I’ll try do before doing any further dev.

Wordpress needs to know where it is, it does that with two DB entries, in the wp_options table, home and site_url, I believe off the top of my head. home points to the web address, and site_url points to the WP installation. Usually they are the same, unless WP is installed to it’s own directory.

Your theme should not contain any absolute URL’s, but if you add an image or a link to the WYSIWYG editor, unfortunately yes, it does add absolute URL’s.

Consider taking a look at http://wp-cli.org/ , it makes handling the database and search-replace a cinch.

Hmm, the wp_options seem fine. Both are http://localhost:8080.

It seems to me like there’s a problem with the URL rewriting. With the default permalinks, the CSS is coming in from /wp-content/themes/roots/assets/css/bootstrap.css, but from /assets/css/bootstrap.css with %postname% (and failing). At the document root I have the .htaccess file and it’s being written to.

The assets rewrite section:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^assets/css/(.*) /wp-content/themes/roots/assets/css/$1 [QSA,L]
RewriteRule ^assets/js/(.*) /wp-content/themes/roots/assets/js/$1 [QSA,L]
RewriteRule ^assets/img/(.*) /wp-content/themes/roots/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>

I have AllowOverride set to All.

Thanks again if you can help.

Ugh, Apache in WAMP doesn’t come with the rewrite module turned on by default. Nice search is working now. Thanks!! :slight_smile:

Good to hear :smile: