• I have my wordpress installed on https://www.domain.nl/wp.domain.nl
    With htaccess in my main directory I rewrite the url https://wp.domain.nl to https://www.domain.nl/wp.domain.nl
    When I go to the shorter url I see my wordpress site.

    But now I want to change the wordpress- and site address in the general settings to the shorter url, which is causing troubles.
    I first only changed the site address, because the other one can be the longer one. If I then go to: https://domain.nl/wp.domain.nl/sample-page/ it shows the error page instead of the page I want to see when I have the longer url filled in.

    The htaccess I use for the main domain is:

    php_value upload_max_filesize 20M
    php_value post_max_size 20M
    php_value max_execution_time 200
    php_value max_input_time 200
    
    AddHandler application/x-httpd-php .gif .jpg .jpeg .png
    php_flag short_open_tag Off
    php_flag display_errors off
    
    RewriteEngine on
    Options +FollowSymlinks
    RewriteBase /
    
    # REDIRECT MAIN DOMAIN
    RewriteCond %{HTTP_HOST} ^(www.)?domain.nl$
    # /subfolder/
    RewriteCond %{REQUEST_URI} !^/www.domain.nl/
    # Don't change this line.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # /subfolder/
    RewriteRule ^(.*)$ /www.domain.nl/$1
    # site
    # subfolder/
    RewriteCond %{HTTP_HOST} ^(www.)?domain.nl$
    RewriteRule ^(/)?$ https://www.domain.nl/ [L]
    
    # SUBDOMAINS to /sub.domain.nl/
    RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.nl$ [NC]
    RewriteCond %{HTTP_HOST} !^www\.domain\.nl$ [NC]
    RewriteRule ^(.*)$ https://domain.nl/%1.domain.nl/$1 [P,L]

    This should do the following:
    https://www.domain.nl -> https://www.domain.nl/www.domain.nl
    sub.domain.nl -> https://www.domain.nl/sub.domain.nl

Viewing 1 replies (of 1 total)
  • Thread Starter rednas

    (@doppiej)

    I discovered that the short urls are working when I have the longer urls in the settings. But still when you click on a link, it goes offcourse to the longer link because that’s the one in the settings.
    How can I make it working with the shorter urls?

Viewing 1 replies (of 1 total)
  • The topic ‘WordPress acts strange in combination with htaccess’ is closed to new replies.