Convert URL’s Uppercase To Lowercase By .Htaccess

 

Redirect all URL or Links from any uppercase latters to lowercase latters using pure mod_rewrite within an .htaccess file.

 

RewriteEngine On
RewriteBase /

# If there are caps, set HASCAPS to true and skip next rule
RewriteRule [A-Z] - [E=HASCAPS:TRUE,S=1]

# Skip this entire section if no uppercase letters in requested URL
RewriteRule ![A-Z] - [S=28]

# Replace single occurance of CAP with cap, then process next Rule.
RewriteRule ^([^A]*)A(.*)$ $1a$2
RewriteRule ^([^B]*)B(.*)$ $1b$2
RewriteRule ^([^C]*)C(.*)$ $1c$2
RewriteRule ^([^D]*)D(.*)$ $1d$2
RewriteRule ^([^E]*)E(.*)$ $1e$2
RewriteRule ^([^F]*)F(.*)$ $1f$2
RewriteRule ^([^G]*)G(.*)$ $1g$2
RewriteRule ^([^H]*)H(.*)$ $1h$2
RewriteRule ^([^I]*)I(.*)$ $1i$2
RewriteRule ^([^J]*)J(.*)$ $1j$2
RewriteRule ^([^K]*)K(.*)$ $1k$2
RewriteRule ^([^L]*)L(.*)$ $1l$2
RewriteRule ^([^M]*)M(.*)$ $1m$2
RewriteRule ^([^N]*)N(.*)$ $1n$2
RewriteRule ^([^O]*)O(.*)$ $1o$2
RewriteRule ^([^P]*)P(.*)$ $1p$2
RewriteRule ^([^Q]*)Q(.*)$ $1q$2
RewriteRule ^([^R]*)R(.*)$ $1r$2
RewriteRule ^([^S]*)S(.*)$ $1s$2
RewriteRule ^([^T]*)T(.*)$ $1t$2
RewriteRule ^([^U]*)U(.*)$ $1u$2
RewriteRule ^([^V]*)V(.*)$ $1v$2
RewriteRule ^([^W]*)W(.*)$ $1w$2
RewriteRule ^([^X]*)X(.*)$ $1x$2
RewriteRule ^([^Y]*)Y(.*)$ $1y$2
RewriteRule ^([^Z]*)Z(.*)$ $1z$2

# If there are any uppercase letters, restart at very first RewriteRule in file.
RewriteRule [A-Z] - [N]

RewriteCond %{ENV:HASCAPS} TRUE
RewriteRule ^/?(.*) /$1 [R=301,L]

 

 

Htaccess Redirect www to non-www

I would like to redirect www.example.com/xyz.html to example.com/xyz.html. The following htaccess code makes this happen.

But if we need to do this for separate http and https:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

 

Bug JTableMenu: :_getNode adding components Joomla

Problem

I am not sure where to start here. I have the same error showing up and new components simply don’t show up in the Joomla 3.5.6 admin Components menu. The components are installed into the site OK but no sign within Admin.

exception ‘UnexpectedValueException’ with message ‘JTableMenu: :_getNode(1, ) failed in /path/libraries/joomla/table/nested.php:1522

Solution

Adding this in the installation or upgrade, etc

INSERT INTO `prefix_menu` (`id`, `menutype`, `title`, `alias`, `note`, `path`, `link`, `type`, `published`, `parent_id`, `level`, `component_id`, `checked_out`, `checked_out_time`, `browserNav`, `access`, `img`, `template_style_id`, `params`, `lft`, `rgt`, `home`, `language`, `client_id`) VALUES
(1, '', 'Menu_Item_Root', 'root', '', '', '', '', 1, 0, 0, 0, 0, '0000-00-00 00:00:00', 0, 0, '', 0, '', 0, 137, 0, '*', 0)

How to remove .html from URL by using .htaccess

To remove .html from the URL of a page. Also, need to redirect any url with .html to the one without for example.

www.example.com/page.html to www.example.com/page

NOTE: When your are testing .htaccess file do not use 301 redirects. Use 302 until finished testing, as the browser will cache 301s.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /foldername/$1 [L,R=301]

Redirect index.html and non www to www using web.config

I use a standard web.config file in my projects which are hosted on Windows servers. Now i need to redirects non www url to www with https and remove the index.html from the url.

<system.webServer>
    <rewrite>
        <rules>
            <rule name="Redirect http://visasimple.com to https://www.visasimple.com HTTP" patternSyntax="ECMAScript" stopProcessing="true">
                <match url=".*"></match>
                <conditions>
                    <add input="{HTTP_HOST}" pattern="^visasimple.com$"></add>
                    <add input="{HTTPS}" pattern="off"></add>
                </conditions>
                <action type="Redirect" url="https://www.visasimple.com/{R:0}" redirectType="Permanent" appendQueryString="true"></action>
            </rule>
            <rule name="redirect index.html" stopProcessing="true">
                <match url="^(\w*/)?index\.html" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="visasimple\.com$" />
                </conditions>
                <action type="Redirect" url="https://www.visasimple.com/{R:1}" />
            </rule>
        </rules>
    </rewrite>      
    <urlCompression doStaticCompression="true" doDynamicCompression="true" />
</system.webServer>

Add custom page title and meta description only product pages in shopify

Go to the theme.liquid file in editor and replace these lines with your existing title and meta description code.

<!---- Title and description ---->
<title>
{% if product %}
Buy {{ product.title }} Online India – {{ shop.name }} {% else %}
{{ page_title }} {% if current_tags %} | tagged "{{ current_tags | join: ', ' }}"{% endif %}{% if current_page != 1 %} | Page {{ current_page }}{% endif %}{% unless page_title contains shop.name %} | {{ shop.name }}{% endunless %}
{% endif %}
</title>

{% if product %}
<meta name="description" content="Buy {{ product.title }} at {{ shop.name }}. Enjoy best deals, free shipping, offers and much more on it. Shop Now!">
{% else %}
{% if page_description %}
<meta name="description" content="{{ page_description | escape }}">
{% endif %}
{% endif %}

Read more

How to add cononical tag in opencart

We have found the way to add the canonical tag on OpenCart website in a easy way…

First we find the catetory.php file from the category folder

catalog/controller/product/category.php file

Find this line:

if ($category_info) {

and add the following lines after that

$can_url=$this->url->link("product/category","path=".$this->request->get[‘path’]); $this->document->addLink($can_url,”canonical”);

Second we find the catalog controllers file

catalog/controllers/common/home.php

Find this line:

$this->document->setDescription($this->config->get(‘config_meta_description’));

and add the above code after that

$can_url=$this->url->link(‘common/home’);
$can_url=str_replace(‘index.php?route=common/home’, ”, $can_url);
$this->document->addLink($can_url,’canonical’);

Hello friends, my name is Hitendra Pushkar. I am also a software engineer like you all. phpblogspot.in has been designed by keeping in mind the needs of software engineers. The platform is for all software engineers.

We have to see a new technology and functionality in every new project. And there is a pressure on us all to submit these projects on stipulated time and deadline. We all do R & D so as to complete all these projects on the given deadline.

At the time of R & D we do something new! Learn! and see! But when we get a new project we forget the R & D efforts we put in the past. Hence we all save our R & D (hardwork) efforts in our email or system. For a while, we remember them. But after some time we forget those efforts too. And to complete the same work again, we have to carry out R & D again wherein we have to waste some time.

Just to preserve those R & D efforts, which we all have learned and seen, phpblogspot.in has been developed for. You can save all your R & D efforts in your account. And whenever you need to see those R & D efforts, you can view in your account and anytime you can use in your projects.

At phpblogspot.in you can easily find the solution of any problem. Your R & D efforts can help all the software engineers. Because all the R & D efforts will be posted in form of a blog, visible to all other users, and ultimately will help all engineers. I just want from all of you to help one another out and move forward!