Redirect after Permalink change – What regex do I use?

You can do this by regex rewriting the legacy URL as a query. You can do that either on the post_id or the postname, in this case I think the postname is probably safer (avoids false matches on some other path that might start with numbers). In custom functions, something like this: add_rewrite_rule( ‘^[0-9]+/(.*)/?’, ‘index.php?&name=$matches[1]’,’top’ … Read more

modifying htaccess for localhost with a custom port

To be honest, I’d change my .conf file to state the correct port if you’ve got access to that. For instance. <VirtualHost *:8012> ServerAdmin webmaster@localhost DocumentRoot /var/www/LOCATION OF FILES <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/LOCATION OF FILES> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> Then i’d restart … Read more

Change dynamically URL to SEO friendly via .htaccess?

EXAMPLE 1 – E-COMMERCE SITE Sad Original URL = site.com/page.php?category=2&product=54 Happy URL 🙂 = site.com/sandwiches/rueben-sandwich/ step 1: Make sure that all category names and product names are unique in your database. step 2: Replace all references to Original URL with the New URL throughout your website. step 3: Use mod_rewrite in your .htaccess file to … Read more

Redirect HTTP request to HTTPS request

Although the answer in the comment to your question will work (here it is formatted), there are some variations that might be needed depending on your hosting environment, so contact your hosting support for specifics. RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]