Simple 301 .htaccess redirect creates infinite redirect on WordPress

I've got a simple 301 redirect to send to get around having blank top level pages on my WP site:

Redirect 301 /page/ https://www.example.com/page/sub-page/

Ends up turning URLs into this though:

https://www.example.com/page/sub-page/sub-page/sub-page/sub-page/sub-page/sub-page/sub-page/sub-page/sub-page/sub-page/sub-page/sub-page/sub-page/sub-page/

How can I fix? Seems strange to me.

Problems setting up a new whitelabel service via CNAME

I have a SAAS and am trying to allow other people to use my SAAS in their own domain. So, supposing my site is app.example.com (hosted with Apache and with PHP as the backend language), I want to allow someone to offer my website from, for example, app.anotherwebsite.com.

I already created a CNAME on app.anotherwebsite.com:

app.anotherwebsite.com CNAME app.example.com.

But if I access app.anotherwebsite.com, it loads the default cPanel page on app.anotherwebsite.com/cgi-sys/defaultwebpage.cgi.

I already tried many solutions offered on the web with no luck. Does anyone have any clue how to solve this? Do I have to do something on the example.com server to fix this?

Thanks a lot!

Problems setting up a new whitelabel service via CNAME

I have a SAAS and am trying to allow other people to use my SAAS in their own domain. So, supposing my site is app.example.com (hosted with Apache and with PHP as the backend language), I want to allow someone to offer my website from, for example, app.anotherwebsite.com.

I already created a CNAME on app.anotherwebsite.com:

app.anotherwebsite.com CNAME app.example.com.

But if I access app.anotherwebsite.com, it loads the default cPanel page on app.anotherwebsite.com/cgi-sys/defaultwebpage.cgi.

I already tried many solutions offered on the web with no luck. Does anyone have any clue how to solve this? Do I have to do something on the example.com server to fix this?

Thanks a lot!

WP multisite htaccess – enforce https in all subdomains but five specific sites remain http

I have this, but it doesn't work. This redirects all sites to https and one site to http. I need 5 sites to be redirected to http; they're special cases.

  RewriteCond %{SERVER_PORT} =80
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  RewriteCond %{HTTP_HOST} ^xxxxxxx\.com [NC]
  RewriteRule ^(.*)$ http://xxxxxxxx/$1 [R=301,L]

Please help

Why does docker-compose use different images/containers for each stack service?

I am migrating from a MAMP stack to docker and can't seem to understand why the interesting docker-compose approach is designed to run different linked containers for every service (say php, mysql, apache) instead of having a container for it all, for the sake of an actual virtual host emulating a whole desired scenario.

Why is it not practical to have them all together?

How to redirect www to non-www https?

I have installed https on my domain. And all this cases are available of my website:

http://example.com        // will be redirected to https://example.com
https://example.com
http://www.example.com    // will be redirected to https://www.example.com
https://www.example.com

See? everything will be using https protocol. All fine.


Now I need to redirect all www to non-www. So http://www.example.com and https://www.example.com should be redirected to https://example.com (in other word, all cases should be redirected to this).

Here is my current code in the /etc/apache2/sites-avalible/000-default.conf:

<VirtualHost *:80>
.
.
.
RewriteEngine on
RewriteCond %{SERVER_NAME} =lamtakam.com [OR]
RewriteCond %{SERVER_NAME} =www.lamtakam.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]               -- this
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]              -- and this are for www redirection
                                                        -- but doesn't work
</VirtualHost>

any idea?

also lamtakam is my exact domain I was talking about, if you need to check something.

RegEx for ${any_text} [duplicate]

This question already has an answer here:

I'm trying to find any solution to extract all variables definition from freemaker template. Lets assume that template looks like this:

Hello ${test_1} Hello ${test_2} Hello ${test_3} Hello ${test_4}

At the output I want to have list of test_1, test_2, test_3, test_4. I tried almost every approach but this $ (special character sign) is causing me a lot of problems also important thing (that also cause me problem) are variables that relate for objects for example ${test_1.user.name}

Debug redirect rule doesn’t match?

I want to redirect

http://localhost/cocoon/data/vm/azure/windows-d11v2promo-standard

to

http://35.227.26.187:5000/cocoon_v1.0?subject=https://w3id.org/cocoon/data/vm/azure/windows-d11v2promo-standard

with this rule, but it doesn't work (tested locally with apache2 server)

RewriteRule ^data/([./]+)$ http://35.227.26.187:5000/cocoon_v1.0?subject=https://w3id.org/cocoon/data/$1 [L,R=308]

I have a working htaccess for https://w3id.org/cocoon/v1.0

I'd like to add redirect rules for something like

https://w3id.org/cocoon/data/vm/azure/windows-d11v2promo-standard https://w3id.org/cocoon/data/storage/azure/premiumssd-p4


[email protected]:/var/www/html/cocoon# cat .htaccess
Options +FollowSymLinks
# Turn off MultiViews https://stackoverflow.com/a/25423722/646732
Options -MultiViews

# Directive to ensure *.rdf files served as appropriate content type,
# if not present in main apache config
AddType application/rdf+xml .rdf
AddType application/rdf+xml .owl
AddType text/turtle .ttl
AddType application/n-triples .n3
AddType application/ld+json .json

# Turn off mod_security filtering.
# SecFilterEngine Off
# SecFilterScanPOST Off

# Rewrite engine setup
RewriteEngine On

# code 308 permanent redirect, cacheable,
# The request method and the body will not be altered,
# whereas 301 may incorrectly sometimes be changed to a GET method.
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308

# flag https://httpd.apache.org/docs/2.4/rewrite/flags.html
# L|last If the rule matches, no further rules will be processed
# NE|noescape Do not convert to hexcode equivalent
# OR Combine rule conditions with a local OR instead of the implicit AND

# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule

# Homepage
RewriteRule ^$ https://github.com/miranda-zhang/cloud-computing-schema [R=308,L]

# make sure we don't have the file or a directory index to serve
# the rest fails to redirect if we do
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]

# Rewrite rule to serve HTML content from the vocabulary URI if requested
# http://localhost/v0.1
RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml.*(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
RewriteRule ^v0\.1/?$ https://miranda-zhang.github.io/cloud-computing-schema/v0.1/index.htm [R=308,NE,L]

# http://localhost/v1.0
RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml.*(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
RewriteRule ^v1\.0/?$ https://miranda-zhang.github.io/cloud-computing-schema/v1.0/index-en.html [R=308,NE,L]

# Rewrite rule to serve JSON-LD content from the vocabulary URI if requested
# curl -H "Accept: application/ld+json" -L http://localhost/v1.0
RewriteCond %{HTTP_ACCEPT} application/ld\+json
RewriteRule ^v1\.0$ https://miranda-zhang.github.io/cloud-computing-schema/v1.0/ontology.json [R=308,L]

# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested
# curl -H "Accept: application/rdf+xml" http://localhost/v0.1
RewriteCond %{HTTP_ACCEPT} \*/\* [OR]
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^v0\.1$ https://miranda-zhang.github.io/cloud-computing-schema/v0.1/ontology/cocoon.rdf [R=308,L]

# curl -LH "Accept: application/rdf+xml" http://localhost/v1.0
RewriteCond %{HTTP_ACCEPT} \*/\* [OR]
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^v1\.0$ https://miranda-zhang.github.io/cloud-computing-schema/v1.0/ontology.xml [R=308,L]

# Rewrite rule to serve N-Triples content from the vocabulary URI if requested
# curl -LH "Accept: application/n-triples" http://localhost/v1.0
RewriteCond %{HTTP_ACCEPT} application/n-triples
RewriteRule ^v1\.0$ https://miranda-zhang.github.io/cloud-computing-schema/v1.0/ontology.nt [R=308,L]

# Rewrite rule to serve TTL content from the vocabulary URI if requested
# curl -LH "Accept: text/turtle" http://localhost/v0.1
RewriteCond %{HTTP_ACCEPT} text/turtle [OR]
RewriteCond %{HTTP_ACCEPT} text/\* [OR]
RewriteCond %{HTTP_ACCEPT} \*/turtle
RewriteRule ^v0\.1$ https://miranda-zhang.github.io/cloud-computing-schema/v0.1/ontology/cocoon.ttl [R=308,L]

# curl -H "Accept: text/turtle" http://localhost/v1.0
RewriteCond %{HTTP_ACCEPT} text/turtle [OR]
RewriteCond %{HTTP_ACCEPT} text/\* [OR]
RewriteCond %{HTTP_ACCEPT} \*/turtle
RewriteRule ^v1\.0$ https://miranda-zhang.github.io/cloud-computing-schema/v1.0/ontology.ttl [R=308,L]

# http://localhost/cocoon/data/vm/azure/windows-d11v2promo-standard
# http://35.227.26.187:5000/cocoon_v1.0?subject=https://w3id.org/cocoon/data/vm/azure/windows-d11v2promo-standard
# https://w3id.org/cocoon/data/vm/azure/windows-d11v2promo-standard
RewriteRule ^data/([./]+)$ http://35.227.26.187:5000/cocoon_v1.0?subject=https://w3id.org/cocoon/data/$1 [L,R=308]

# cat .htaccess
RewriteEngine On
RewriteRule ^data/([./]+)$ http://35.227.26.187:5000/cocoon_v1.0?subject=https://w3id.org/cocoon/data/$1 [L,R=308]

# service apache2 reload
 * Reloading Apache httpd web server apache2                                                                                       *
# wget http://localhost/cocoon/data/vm/
--2018-10-17 06:09:10--  http://localhost/cocoon/data/vm/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 406 Not Acceptable
2018-10-17 06:09:10 ERROR 406: Not Acceptable.

Just another Blog Hosting Sites site