Category Archives: .htaccess

How to remove query string variable from url

How to remove query string variable name from htaccess ? I have following structure.

http://localhost/newsite/category?id=News
http://localhost/newsite/category?id=Entertainment
http://localhost/newsite/category?id=Technology

I want to change

http://localhost/newsite/News/
http://localhost/newsite/Entertainment/
http://localhost/newsite/Technology/

like this. I tried rewriting in htaccess, but doesn't work

Oscommerce to OpenCart Redirects

The way that Oscommerce SEO Friendly URLs work, is that they are generated from a product or category title followed by a p for product and c for category, then the product or category ID. For categories, each parent directory ID is also used. for example:

https://example.com/jeep-pinion-gears-c-284_845.html

over the course of many years, products and categories get edited and moved therefore changing the URL. However, all the old URL's still resolved because pages are served strictly based off of the last part of the URL. It looks for the c or p and the ID's. SEO is still able to be maintained. For Example:

https://example.com/jeep-pinion-gears-c-284_845.html
https://example.com/jeep-pinion-gears-and-accessories-c-284_845.html
https://example.com/jeep-pinion-gears-c-284_1234_845.html
https://example.com/ring-pinion-gears-c-845.html

Would all load the same content.

I've recently changed over to OpenCart where I used the latest URL for each product and category from the OsCommerce store. However, all the of Old Oscommerce URL's don't work.

I was originally writing some regex redirects to match the ID's but I'm running into redirect loop issues.

Does anyone any any ideas on a different approach?

htaccess redirect all domain except one subfolder including the files and other subfolders inside

I'm currently using:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/folder/.*
RewriteCond %{REQUEST_URI} !^/folder$
RewriteRule .* https://www.newdomain.com/ [R=301,L]

Which works great at redirecting the "folder" to the "newdomain," including the files within that folder, however, the subfolders within that folder still redirect.

I've tried:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/folder/.*
RewriteCond %{REQUEST_URI} !^/folder$
RewriteCond %{REQUEST_URI} !^/folder/subfolder/.*
RewriteCond %{REQUEST_URI} !^/folder/subfolder$
RewriteRule .* https://www.newdomain.com/ [R=301,L]

As well as:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/folder/.*
RewriteCond %{REQUEST_URI} !^/folder$
RewriteCond %{REQUEST_URI} !^/subfolder/.*
RewriteCond %{REQUEST_URI} !^/subfolder$
RewriteRule .* https://www.newdomain.com/ [R=301,L]

with no luck.

Any suggestions?

Load domain from a sub folder

I am new to windows hosting...

I have a hosting with 3 domains added to it. This is what I want to achieve:

My Main system url is http://xxx.xx.xx.x/winhost/hrm_test/

www.mydomain1.co.uk =>  http://xxx.xx.xx.x/winhost/hrm_test/STAFF_Area/*
www.mydomain2.co.uk =>  http://xxx.xx.xx.x/winhost/hrm_test/reports_manager/*
www.mydomain3.co.uk =>  http://xxx.xx.xx.x/winhost/hrm_test/support_team/*

the subfolders are not actually existing folders but post variables changed using web.config... is it possible to have addon domains to always request these subfolders

Load domain from a sub folder

I am new to windows hosting...

I have a hosting with 3 domains added to it. This is what I want to achieve:

My Main system url is http://xxx.xx.xx.x/winhost/hrm_test/

www.mydomain1.co.uk =>  http://xxx.xx.xx.x/winhost/hrm_test/STAFF_Area/*
www.mydomain2.co.uk =>  http://xxx.xx.xx.x/winhost/hrm_test/reports_manager/*
www.mydomain3.co.uk =>  http://xxx.xx.xx.x/winhost/hrm_test/support_team/*

the subfolders are not actually existing folders but post variables changed using web.config... is it possible to have addon domains to always request these subfolders

Block EU countries to access my site via .htaccess?

Hi i have basic HTML site with a few pages. I want to block access from EU countries via .htaccess file i have into my root dir. I inserted this code on top of htaccess file, but seems that not make any changes.

<ifModule mod_geoip.c>

GeoIPEnable On
# Add countries you wish to deny here

SetEnvIf GEOIP_COUNTRY_CODE AL DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE AD DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE AM DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE AT DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE AM DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE AZ DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE BY DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE BE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE BA DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE BG DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE HR DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE CY DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE CZ DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE DK DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE EE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE FI DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE FR DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE GE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE DE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE GR DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE HU DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE IS DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE IE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE IT DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE KZ DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE LV DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE LI DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE LT DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE LU DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE MK DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE MT DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE MD DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE MC DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE ME DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE NL DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE NO DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE PL DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE PT DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE RO DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE RU DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE SM DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE RS DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE SK DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE SI DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE ES DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE SE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE CH DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE TR DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE UA DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE GB DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE VA DenyCountry
Allow from all

Deny from env=DenyCountry

</ifModule>

Can someone to help me with this? Maybe not works due to mod_geoip.c is not enabled as module into cPanel?

Block EU countries to access my site via .htaccess?

Hi i have basic HTML site with a few pages. I want to block access from EU countries via .htaccess file i have into my root dir. I inserted this code on top of htaccess file, but seems that not make any changes.

<ifModule mod_geoip.c>

GeoIPEnable On
# Add countries you wish to deny here

SetEnvIf GEOIP_COUNTRY_CODE AL DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE AD DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE AM DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE AT DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE AM DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE AZ DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE BY DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE BE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE BA DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE BG DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE HR DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE CY DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE CZ DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE DK DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE EE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE FI DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE FR DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE GE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE DE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE GR DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE HU DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE IS DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE IE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE IT DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE KZ DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE LV DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE LI DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE LT DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE LU DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE MK DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE MT DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE MD DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE MC DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE ME DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE NL DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE NO DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE PL DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE PT DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE RO DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE RU DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE SM DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE RS DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE SK DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE SI DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE ES DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE SE DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE CH DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE TR DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE UA DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE GB DenyCountry

SetEnvIf GEOIP_COUNTRY_CODE VA DenyCountry
Allow from all

Deny from env=DenyCountry

</ifModule>

Can someone to help me with this? Maybe not works due to mod_geoip.c is not enabled as module into cPanel?

Show the link as if it was linked to the file using htaccess

can we show the url like this using htaccess

http://www.example.com/group/goroupName

I have group.php file in the pages folder. I want to show the url like above.

I have tryed it like this rule

RewriteRule ^group/([\w-]+)/?$ pages/group.php?group_username=$1 [L,QSA]

but some included php files not displayed. For example :

<?php 
    include_once '../../functions/includes.php';
   if(isset($_GET['group_username'])) {
    $group_username=$_GET['group_username'];
    include_once '../../functions/includes/get_group.php';  
    if(empty($group_profile_owner_id)){
      header("Location:$url404");
    }
   }else{
      header("Location:$url404");
   }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="theme-color" content="#8e24aa">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<title><?php echo $group_username;?></title>
<?php include("../../themes/$getTemplate/contents/style_js.php");?>
</head>

<body>

in the above code this include not displayed:

<?php include("../../themes/$getTemplate/contents/style_js.php");?>

What is the problem in my RewriteRule

Can’t Access wp-admin after hosting in new domain

I know that question asked many times before and I tried many of them but cant find solution. this is my site url http://www.primeproductionltd.com (most of things work fine) http://www.primeproductionltd.com/wp-admin/

previousy It is on server - http://applanche.com/prime-production/wp-admin/

in have added in my wp.config

define('WP_HOME','primeproductionltd.com/'); 
define('WP_SITEURL','primeproductionltd.com/')

My Htaccess is

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

# END WordPress

There is some cookie and rediret error shown.