Redirect main domain to subdirectory

From the two .htaccess files you posted I can’t see how your site is working at all?! If you request example.com/ (the document root) then the second rule in the root .htaccess file rewrites the request directly to /subdirectory/index.html (not index.php). If /subdirectory/index.html exists then the (non-WordPress) file is served, otherwise see #2 If you … Read more

What is the purpose of storing `siteurl` in database?

Since you mention multiple environments you can manually define the site URL within your wp-config.php file define(‘WP_SITEURL’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/path/to/wordpress’); define(‘WP_HOME’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/path/to/wordpress’); Keep in mind that it will override what you have set in your options table. As detailed in the documentation: Setting this value in wp-config.php overrides the … Read more

Concatenate site_url and string doesn’t work

Without knowing exactly what you are trying to do, it seems you want to append query variables to the URL. WordPress has methods for handling that properly, without manual string concatenation. Look at the documentation for add_query_arg() for details: https://developer.wordpress.org/reference/functions/add_query_arg/ You can rebuild the URL and append query variables to the URL query by using … Read more

Why does WordPress rely on an fully qualified site_url with a 15-step plan for moving a site?

This question has been discussed several times on the WordPress Hackers email list, I’d recommend Googling something like wp-hackers absolute relative to get an overview of the various lively debates that have taken place over the years. Personally I use the searchreplacedb2 script whenever I migrate a database between URLs, e.g. from live to local/test/dev.

redirect 301 old url to new url

Well, you would have to add some re-write rules in your .htaccess file (unless there’s a plugin that can allow more complex 301 redirect rules). But, in your situation, if I understand correctly, it’s simply not possible to do it in one generic rewrite rule, due to the logic of your new URLs… If all … Read more

URL rewriting for WordPress Network (Multisite) subsite

This is straightforward if I understand the question properly. Use the “WordPress MU Domain Mapping” plugin: http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/ Update I think something like the following should work in your .htaccess: RewriteCond %{HTTP_HOST} www.exampleurl.com RewriteCond %{REQUEST_URI} !^/testsite RewriteRule ^(.*)$ testsite/$1 [L] This will return the contents of the folder “testsite” for “www.exampleurl.com”. And if you have: www.exampleurl.com/myoldsite/ … Read more

Woocommerce different URL for every table placed in the restaurant

I don’t have a WooCommerce currently to test this out on, so it’s very rough and ready, and may not even work… But, I think the logic is fairly sound. Give this a go: // Store session value for table number add_action(‘init’, ‘store_table_number’); function store_table_number() { if( $_GET[‘dining’] ) { global $tableNo; $tableNo = array( … Read more

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