htaccess, site and staging in subdirectories

Assuming the /wp2 subdirectory containing the staging site has its own WordPress .htaccess file (with the standard WordPress front-controller, see below). Then the .htaccess in the document root should contain something like the the following, above any existing directives, to rewrite all requests to the wp2 subdomain to the /wp2 subdirectory: RewriteEngine On RewriteCond %{HTTP_HOST} … Read more

Redirections and rewrites to subdomain

Redirect 301 /privacy-statement https://example.com/privacy/ You should avoid using a mod_alias Redirect directive when you are already using mod_rewrite for other redirects. mod_alias runs after mod_rewrite, regardless of the apparent order of the directives in your .htaccess file, so it’s possible to get unexpected conflicts. This should be converted to a mod_rewrite (RewriteRule) redirect instead: RewriteRule … Read more

URL Rewriting for PHP script on an image URL

Try the following at the top of the .htaccess file, before the existing WordPress directives: # Internally rewrite “/image.jpg” to “/randomizer.php” RewriteRule ^image\.jpg$ randomizer.php [L] This uses mod_rewrite to rewrite the URL. There is no need to repeat the RewriteEngine On directive (that occurs later in the file). Any request for /image.jpg (in the document … Read more

Why is the domain name missing from the logout redirect?

I have traced the problem to this code in wp-login.php: case ‘logout’ : check_admin_referer(‘log-out’); $user = wp_get_current_user(); wp_logout(); echo “hello”; echo $_REQUEST[‘redirect_to’]; if ( ! empty( $_REQUEST[‘redirect_to’] ) ) { $redirect_to = $requested_redirect_to = $_REQUEST[‘redirect_to’]; } else { $redirect_to = ‘wp-login.php?loggedout=true’; $requested_redirect_to = ”; } It appears if I change this line: $redirect_to = ‘wp-login.php?loggedout=true’; … Read more

Site in subfolder – all pages work except home

Because when you request the document root, the rule in .htaccess does not match and the request is not rewritten to the subdirectory. So the request falls through and whatever is the default response for the document root is served (eg. /index.php if it exists). You need to add another directive to rewrite the homepage … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)