Redirect main domain to subdirectory

Following the following code sample I managed to redirect it, however the site URL on the browser show as domain.com/subdirectory and not domain.com.

RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$   RewriteCond %{REQUEST_URI} !^/subdirectory/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$   /subdirectory/$  1 RewriteCond %{HTTP_HOST} ^(www.)?example.com$   RewriteRule ^(/)?$   subdirectory/index.html [L] 

Alias subdirectory as a subdomain on root domain

I have the following structure:

example.com (Root), app.example.com (actual application)

Users can access their profile as: app.example.com/view/username for example

Is there a way I can show the content of app.example.com/view/username in username.example.com directly?

I tried creating a wildcard subdomain but it doesn’t seem to work as right now I have 2 htaccess files (one for example.com and the other for app.example.com).

Thanks in advance!

Edit:

File structure is Angular’s (it has Routing already) so it doesn’t make a difference

OS: CentOS 7, using Apache

How to list blog post from subdirectory wordpress install to the main site

I have decided to separate my main website and my blog with different WordPress installs. I’ve installed my blog in the subdirectory (/blog/ folder) and my main WordPress is only contained homepage and pages related to my business.

The problem is, is it possible to create a section on my main website that lists 4 latest posts from my blog that are installed in the subdirectory? I have searched all over the internet for the solution, but I’ve found nothing.

Can you tell me how can I solve this?

Redirect to a subdirectory frontpage using without using a WP plugin- what files to edit, and how?


My situation

I have a multisite setup, where I use subdirectories for different languages. I use the main homepage for English and subdirectories for other languages, as follows:

mywesbite.com : English language frontpage

mywebsite.com/jp/ : Japanese language frontpage

What I want to do

I would like to redirect people who live in Japan to the Japanese language ffrontpage without using a WordPress plugin.

What I have tried

Using the geoplugin.com , as inspired by the 3rd answer of this stack I edited the theme header.php file by adding the following at the very beginning

$  a = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$  _SERVER['REMOTE_ADDR'])); $  countrycode= $  a['geoplugin_countryCode']; if ($  countrycode=='JP'){         header( 'Location: https://mywebsite.com/jp/' );         exit;     } 

The problem

However, I get the following error

The page isn’t redirecting properly

An error occurred during a connection to mywebsite.com.

This problem can sometimes be caused by disabling or refusing to accept cookies.

Note: the redirecting works fine with an external website, for example

$  a = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$  _SERVER['REMOTE_ADDR'])); $  countrycode= $  a['geoplugin_countryCode']; if ($  countrycode=='JP'){         header( 'Location: https://anotherwebsite.com' );         exit;     } 

Is there a way to fix this error?

I am also open to other solutions not using a WP plugin.

Aesthetic URL problem: Website from server02 should look like its on a subdirectory of the main site from server01

www.example.com is on server01 with IP address 192.0.2.123

abc.example.com is on server02 with IP address 192.0.2.21

I actually do not want the subdomain abc. Ideally I want it at www.example.com/abc. I want to have a more cohesive website for usability and aesthetics. For non-technical people, having the content in a sub-directory feels that you are still on the same site compared to going to a sub-domain.

My problem is that the code for the subdomain site (Site2) is on server02 with a different IP. I cannot use just 1 server for the 2 sites: Site1 is using Apache, MySql, and PHP for PHP websites and static websites. Site 2 is a webapp that uses nginx, ruby and postgresql. Maintenance wise, IMHO, it is easiest to have site02 on a separate server. But as I said, it would be great if it can be visited by the end-user in a sub-directory of the main domain.

Is there a a way for me to achieve this?

What is the correct url syntax for mytheme.css to access items in it’s sub-directory?

The alternative of my gdm3 is installed at /usr/share/gnome-shell/theme/mytheme/mytheme.css. It’s assets directory, which stores all the .svg files, is located at /usr/share/gnome-shell/theme/mytheme/assets. A typical selector in mytheme.css accesses the .svg files in the “assets” directory like so:

.toggle-switch-us {   background-image: url("assets/toggle-off.svg"); }   .toggle-switch-us:checked {     background-image: url("assets/toggle-on.svg"); } 

However, these svg images (and all the other .svg images) do not seem appear in the gnome greeter and unlockscreen.

What is the proper url syntax to declare what I want?

Multi-server – how do I link my WordPress blog to a subdirectory of my static site?

we have a static site example.com (an Azure App Service) that we’ve been running for some time. We would like to use WordPress to start a blog in a subdirectory at example.com/blog. The WordPress instance has been set up using a separate PHP Azure App Service and Azure Database for MySQL Server.

If the browser requests /blog or anything deeper, e.g. /blog/morecontent, what are the steps I need to take to tell the browser that the content lives on a the PHP server. This is of course without URL masking – I’d like search engines to think that the /blog content is part of the example.com hierarchy.

I imagine there are multiple steps to set up here like permanent redirects, DNS, WordPress URL/URI config and more. I’m just a little lost and don’t know where to start, and so I might not be even framing the question correctly.

Any help or direction on where to look is most appreciated! I haven’t found anything on StackExchange yet that covers the static+PHP scenario.

Thanks!

Bash script for consolidating subdirectory files into a single directory of uniquely named files

I’d like to recurse through subdirectories and move files into the current directory. As I don’t want to overwrite anything in the current directory I’d like to append or prepend numbers to any duplicate file names, if they conflict with something in the current directory.

I’ve tried stuff like:

mv -i **/*.* . 

But that’ll just skip conflicts.

Any tips on easy commands to do this?