ALL websites in my WHM redirect to same domain if i hit non ssl version of url

I have a WHM cpanel with over 10 + domain
say site 1 to site 10

i install ssl in site no. 8 , 9 , 10
now if i i call non ssl version like http://www…
for site no 8,9,10 , it call the first site hosted on my whm no matter the domain called

I have most of the websites that are related to
Matrimonial script
so all sites look almost same
following is the .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

magento2 – Remove .html from category in product URL?

For some reason, I am getting .html in my product URL, like so: https://example.com/mycategory.html/myproduct.html. I want to remove .html from mycategory when I am on a product page.

Is there a setting for this? I know I can remove .html from the category completely, but this is not what I want, I want it to be there in category pages. Strange thing is, for some products it works, no .html in the category path.

Magento 2.3.3

Thanks

url – How to create a link in OneNote that opens inside Teams’ frame?

If I enter a Microsoft Team, then go to the Notebook, and create a page using OneNote, I can create a Web link to an external page. When I click the link, it opens it in a new tab or window. How can I get it to open, but still within the frame of Teams, so users can still see the channels links to the right and the tabs along the top?

Code snippet to add filter pre_post_link to change Media URL (post_type attachment permalink/slug)

I found a very good code snippet to add a “base” into URL of blog posts:
Custom permalink structure with a prefix just for posts

I tested it and it works great for post_type: post (to test it I created a “Must Use Plugin” in wp-content/mu-plugins/rewrite-me.php with the PHP code).

I tried to modify it for Media by changing post to attachment but it doesn’t work… Could you please tell me what’s wrong with it?

Ideally I don’t want to use a plugin for this. I would like all attachments (media) links to have a base in URLs. For example image my-cat.jpg gets by default permalink/slug example.com/my-cat but I would prefer if it can get example.com/someprefix/my-cat. Could you please help me with that?

<?php

add_filter('pre_post_link', 'se332921_pre_post_link', 20, 3);
add_filter('post_rewrite_rules', 'se332921_post_rewrite_rules');

/**
 * @param string  $permalink The site's permalink structure.
 * @param WP_Post $post      The post in question.
 * @param bool    $leavename Whether to keep the post name.
 */
function se332921_pre_post_link($permalink, $post, $leavename)
{
    if ( $post instanceof WP_Post && $post->post_type == 'attachment')
        $permalink = '/attachment-prefix'.$permalink;
    return $permalink;
}

/**
 * @param array $post_rewrite The rewrite rules for posts.
 */
function se332921_post_rewrite_rules($post_rewrite)
{
    if ( is_array($post_rewrite) )
    {
        $rw_prefix = ();
        foreach( $post_rewrite as $k => $v) {
            $rw_prefix( 'attachment-prefix/'.$k) = $v;
        }
        //
        // merge to keep original rules
        $post_rewrite = array_merge($rw_prefix, $post_rewrite);
        //
        // or return only prefixed:
        // $post_rewrite = $rw_prefix;
    }
    return $post_rewrite;
}

Thank you ;-).

Kind regards,

Ben

8 – Create URL encoded taxonomy term name in views field

I have a view of taxonomy terms where I need to overwrite the output of a couple fields to be Solr search URLs, and part of the URL is the url encoded term name. So, for instance, if my term name is Agriculture & Forestry, I need it to be encoded to Agriculture+%26+Forestry. My initial approach was to use the Output this field as a custom link setting under Rewrite Results in the field settings by inserting the {{ name }} in the URL, but that’s obviously not encoded, so I would have to use a prerender or preprocess function to encode a string that is part of a long URL (not exactly efficient).

What would be a better way to do this? My next thought is something I’ve done before, which is override a field plugin, but that might be a bit of overkill.

url redirection – Preventing open redirects / xss on a variable return url / iframe

Let’s assume I have a website where I have to either redirect the user to an other URL or include an other URL in an iframe, that is given by a GET parameter.
I cannot use HMAC when the URL is created. The site is designed to work with relative URLs.

e.g. login.php?redirect=profile.php

This is vulnerable to open redirect (login.php?redirect=//evil.com/change_password_form.php) and XSS (login.php?redirect=javascript:alert('evil')) if not protected.

Allowing absolute URLs is not a problem, these are easy to allow by a list.

To check relative URLs and XSS is harder…

Would it be enough to:

  1. remove white-spaces and non printable characters or deny if these exist
  2. deny if starts with //
  3. deny if contains : NOT preceded by ?, / or #

3 would prevent switching the scheme, 2 would prevent going to another origin.

Other approaches suggest using a Lib for URL parsing (but these fail too) or using CSP (but that is something that sould be used in addition and not as the only defense).

When using an URL parser, is it enough to:

  1. remove white-spaces and non printable characters or deny if these exist
  2. deny if parsed scheme/protocol is not empty
  3. deny if parsed host/hostname/domain/authority (some parser have a lots of fields here) is not empty
  4. deny if parser has an error

Since parsing URLs is hard I’m 100% sure I missed something 😉
So I leave this open for discussion here. What would you do?
Thx

url rewriting – add_rewrite_rule with query variables

We have rewrite rules as:

add_action( 'init', function() {
    add_rewrite_rule( 'app-api/v2/ecommerce((a-z0-9-)+)(/)?$', 'index.php?p=$matches(1)&post_type=product' );
} );

for the URL – www.domain.com/app-api/v2/ecommerce/14. We load a custom template using template_include hook for custom rules.

The above works fine, but for some specific reasons the client wants to make use of query variables so that the new URL will be of the form www.domain.com/app-api/v2/ecommerce?pid=14

What I am trying to achieve is something like this, which doesn’t work.

add_action( 'init', function() {
   $id = $_GET('pid');
   add_rewrite_rule( 'app-api/v2/ecommerce', "index.php?p={$id}&post_type=product" );
} );

What is the correct way to add a rewrite rule with dynamic query variables?

google drive – Why can’t distinct Youtube channels have also distinct URL?

On YouTube, when signed in to multiple accounts, you cannot use both at the same time. While you remain signed in to both accounts, YouTube sets one as the active account at a time. This is so that your watch history is logged to only one, and so your recommended videos for that account isn’t influenced by other accounts signed in.

Say your buddy signed in on your computer. You wouldn’t want him watching a video to influence your recommended.

So in order to use the account not set as active, you have to press the icon at the top, icon and press switch accounts.

switch

Then select the account you want to use.

The inactive account should not get disconnected unless you’re pressing sign out instead of switch account.