htaccess tip

0
515

AddType application/x-httpd-ea-php56 .php .php5 .phtm .html .htm kindly read php as html

godaddy html page php code

Options +ExecCGI
AddHandler fcgid-script .htm
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .htm

# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>

# disable the server signature
ServerSignature Off

# limit file uploads to 10mb
LimitRequestBody 10240000

# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>

#who has access who doesnt
order allow,deny
#deny from 000.000.000.000
allow from all

#custom error docs
ErrorDocument 404 /404.php

# disable directory browsing
Options All -Indexes

#redirect old to new
Redirect 301 /old.php http://www.yourdomain.com/new.php

#block referring domains
RewriteEngine on
RewriteCond %{HTTP_REFERER} digg\.com [NC] RewriteRule .* – [F]

#disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC] #RewriteRule \.(gif|jpg)$ – [F] #RewriteRule \.(gif|jpg)$ http://www.yourdomain.com/stealingisbad.gif [R,L]

# php compression – use with caution
<ifmodule mod_php4.c>
php_value zlib.output_compression 16386
</ifmodule>

# set the canonical url
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC] RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]

# protect from spam comments
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourdomain.com.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

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

Preventing Directory Listing

IndexIgnore *.gif *.jpg
// imortant link to study porpose http://corz.org/serv/tricks/htaccess2.php
http://www.besthostratings.com/articles/prevent-hot-linking.html

Welcome to .htaccess Tools

1 [NC] http host is case insensitive
2 ^ means that the host starts with
3 (.) means that one character is unspecified
4 .* means that you can have a lot of characters, not only one

5. In other words, (.+) = $1 you could have multiple (.+) parts and for each, mod_rewrite automatically creates a matching $1, $2, $3, etc, in your target (aka. ‘substitution’)

6. http://www.domain.com/$1 describes the target of the rewrite rule – this is our “final”, used domain name, where $1 contains the content of the (.*)

7. [L,R=301]. L means in this is the last rule in this run after this rewrite the webserver will return a result. The R=301 means that the webserver returns a 301 moved permanently to the requesting browser or search engine.

8. The [NC] part at the end means “No Case”, or “case-insensitive”;

9. “L” flag to the mix; meaning “Last Rule”

10. [R] alone, it defaults to sending an HTTP “MOVED TEMPORARILY” redirection, aka, “302”.

11. # users can load only “special.zip”, and the css and js files. in chat folder
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !^(.+)\.css$
RewriteCond %{REQUEST_FILENAME} !^(.+)\.js$
RewriteCond %{REQUEST_FILENAME} !special.zip$
RewriteRule ^(.+)$ /chat/ [NC]

12. . (any character)
* (zero of more of the preceding)
+ (one or more of the preceding)
{} (minimum to maximum quantifier)
? (ungreedy modifier)
! (at start of string means “negative pattern”)
^ (start of string, or “negative” if at the start of a range)
$ (end of string)
[] (match any of contents)
– (range if used between square brackets)
() (group, backreferenced group)
| (alternative, or)
\ (the escape character itself)
example
RewriteRule ^parrots/([A-Za-z0-9-]+)/?$ get_product_by_name.php?product_name=$1 [NC,L] # Process parrots

13. Flags

Flags are added to the end of a rewrite rule to tell Apache how to interpret and handle the rule. They can be used to tell apache to treat the rule as case-insensitive, to stop processing rules if the current one matches, or a variety of other options. They are comma-separated, and contained in square brackets. Here’s a list of the flags, with their meanings (this information is included on the cheat sheet, so no need to try to learn them all).

C (chained with next rule)
CO=cookie (set specified cookie)
E=var:value (set environment variable var to value)
F (forbidden – sends a 403 header to the user)
G (gone – no longer exists)
H=handler (set handler)
L (last – stop processing rules)
N (next – continue processing rules)
NC (case insensitive)
NE (do not escape special URL characters in output)
NS (ignore this rule if the request is a subrequest)
P (proxy – i.e., apache should grab the remote content specified in the substitution section and return it)
PT (pass through – use when processing URLs with additional handlers, e.g., mod_alias)
R (temporary redirect to new URL)
R=301 (permanent redirect to new URL)
QSA (append query string from request to substituted URL)
S=x (skip next x rules)
T=mime-type (force specified mime type)

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

15 Removing the Query_String
On many sites, the page will be displayed for both page.html and page.html?anything=anything, which hurts your SEO with duplicate content. An easy way to fix this issue is to redirect external requests containing a query string to the same uri without the query_string.
RewriteCond %{THE_REQUEST} ^GET /.*;.* HTTP/
RewriteCond %{QUERY_STRING} !^$
RewriteRule .* http://www.askapache.com%{REQUEST_URI}? [R=301,L]

16. Deny Access To Everyone Except PHP fopen
RewriteCond %{THE_REQUEST} ^.+$ [NC] RewriteRule .* – [F,L]

How to prevent or allow directory listing?
Options +Indexes or
IndexIgnore *.gif *.zip *.txt

How to block users from accessing your site based on their IP address
Order allow, deny
Deny from 192.168.0.10
Deny from 212.155.
Deny from 1.2.3.4 5.6.7.8 127.0.0.1
Allow from all
Allow from 1.2.3.4

How to change the error documents – 404 Page Not Found, etc
ErrorDocument 404 /notfound.html
ErrorDocument 500 /internal_error.html
ErrorDocument 401 /authorization_required.html
ErrorDocument 403 /forbidden.html
synatax
ErrorDocument <error_code> <path_to_file>
400 Bad Request
The server received a request it cannot handle due to bad syntax for example

401 Unauthorized
Such an error will show up in case a user did not supply a proper login credentials when using the .htaccess based user/pass protection

403 Forbidden
The request page is forbidden. Such an error shows up when you have a Deny from directive

404 Not Found
As the error message says the page that you have requested cannot be found on the server.

410 Gone
The requested page have been removed permanently

500 Internal Server Error
The server encountered an error. Usually such error messages show up with CGI scripts. Also you can get such an error message when you have bad syntax in your .htaccess file.
Please, note that the ErrorDocument directive can only be used with local file paths.
This means that you cannot define an error document using full URL, such as:
ErrorDocument 404 http://www.example.com/errors/missing.html

Redirect URLs using .htaccess
RedirectMatch “\.html$” http://www.example.com/index.php
This will redirect all requests to files that end with .html to the index.php file.
Introduction to mod_rewrite and some basic examples
RewriteRule ^([a-z]*)/([a-z]*)/([1-9]+)(-[1-9]+)? $ http://www.example.com/view.php?cat=$2&a=$3&page=$4&lang=$1 [L]

Using .htaccess to block referrer spam
To block these spam referrers you need the following lines in your .htaccess file:

# set the spam_ref variable
SetEnvIfNoCase Referer “^http://(www.)?some-spammer.com” spam_ref=1

SetEnvIfNoCase Referer “^http://(www.)?other-spammer.com” spam_ref=1

SetEnvIfNoCase Referer “^casino-poker” spam_ref=1

# block all referres that have spam_ref set
<FilesMatch “(.*)”>
Order Allow,Deny
Allow from all
Deny from env=spam_ref
</FilesMatch>
Disable Hot-Linking of images and other files
RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$

RewriteCond %{HTTP_REFERER} !^http://(www.)?your-domain.com/.*$ [NC]

RewriteRule \.(gif|jpe?g|png)$ – [F] To block other type of files, just add their extension to the list above. For example to block movie files:

RewriteRule \.(mov|avi|wmv|mpe?g)$ – [F]

Force SSL/https using .htaccess and mod_rewrite
accomplished with a .htaccess file containing the following lines:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

Please, note that the .htaccess should be located in the web site main folder.

In case you wish to force HTTPS for a particular folder you can use:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} somefolder
RewriteRule ^(.*)$ https://www.domain.com/somefolder/$1 [R,L]

301 Permanent redirects for parked domain names
If you have several domain names parked/pointed at your site it is a good idea to create permanent 301 redirect for them so for the search engines not to treat them as duplicate content.

Here is a sample .htaccess that will do that:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^parkeddomain.com$ [OR] RewriteCond %{HTTP_HOST} ^parkeddomain-2.com$
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [R=301]

And even more generic solution would be:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.maindomain.com$
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [R=301]

Enable CGI, SSI with .htaccess

As .htaccess is a powerful tool. It gives you option to change the way the webserver serves your files. On most web hosting servers you can use SSI (Server Side Includes) in shtml, or shtm files.

However, you need to use SSI in your .html and htm files. There is an easy solution for this.
Just add the following line in your .htaccess file:

AddHandler server-parsed .html .htm

This line will tell the server to parse your .htm file as SSI and execute any SSI directives you have there.

You can also use .htaccess to enable CGI scripts execution as well as change the default extension for such files as well.

For Perl/CGI scripts you will need:

AddHandler cgi-script .cgi .pl

To make PHP files to be parsed as PHP when PHP is running as module

AddType application/x-httpd-php .html .htm

To make PHP files to be parsed as PHP when PHP is running as CGI (suexec, etc)

AddHandler application/x-httpd-php .html .htm

How to add Mime-Types using .htaccess
You can change this using .htaccess file.

For example if you need to configure your server to display ASX files:

AddType video/x-ms-asf asf asx

For windows media audio WMA

AddType audio/x-ms-wma .wma

A comprehensive list of mime-types can be found here

There is one more useful feature of the AddType directive. Most of you most probably know that Internet Explorer opens MS Word, Excell, PDF and some other files inside a browser window. To force the browser to download the file you can use AddType to change the document type:

AddType application/octet-stream .doc .xls .pdf

Change default directory page
DirectoryIndex home-page.html Home.html, index.html index.php index.cgi
Block Bad robots, spiders, crawlers and harvesters
SetEnvIfNoCase user-agent “^Website\ Quester” bad_bot=1
SetEnvIfNoCase user-agent “^WebStripper” bad_bot=1
SetEnvIfNoCase user-agent “^WebWhacker” bad_bot=1
SetEnvIfNoCase user-agent “^WebZIP” bad_bot=1
SetEnvIfNoCase user-agent “^Widow” bad_bot=1
SetEnvIfNoCase user-agent “^WWWOFFLE” bad_bot=1
SetEnvIfNoCase user-agent “^Xaldon\ WebSpider” bad_bot=1
SetEnvIfNoCase user-agent “^Zeus” bad_bot=1
<FilesMatch “(.*)”>
Order Allow,Deny
Allow from all
Deny from env=bad_bot
</FilesMatch>

And of course here it is the ModRewrite based example:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR] RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR] RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR] RewriteCond %{HTTP_USER_AGENT} ^Custo [OR] RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR] RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR] RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR] RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR] RewriteCond %{HTTP_USER_AGENT} ^Zeus
RewriteRule ^.* – [F,L]

Make PHP to work in your HTML files with .htacess
AddType application/x-httpd-php .html .htm
AddHandler application/x-httpd-php .html .htm

Change PHP variables using .htaccess
The syntax is pretty simple:

php_flag [variable_name] [value]

php_flag register_globals off
If you need to change the PHP include path:

php_value include_path “.:/usr/local/lib/php:/your_include/path”

Duplicate content fix index.html vs / (slash only)
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.domain.com/ [R=301,L]

https redirection look bluelineclassics.com site

all page redirect www

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301] RewriteCond %{REQUEST_URI} ^/index.php$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/ [R=301,L] #RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !ipopeng.htm

or www redirect

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.your_domain.com$
RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.your_domain.com/ [R=301,L]

https to http redirection
RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RedirectMatch 302 ^/blog/.*$ http://domain.tld/target.html

Ci PROJECT REDIRECTION
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.SITENAME.com/$1 [L,R=301] RewriteCond %{REQUEST_URI} ^/home$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/ [R=301,L]

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

joomla www and index page redirection
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301] RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.2i.ae/$1 [R=301,L]

//add url change 301 example
//http://www.dreamflowershouston.com/products/62/modern
//to
//http://www.dreamflowershouston.com/products/62/modern-flowers

RewriteCond %{REQUEST_URI} !flowers$
RewriteRule ^products/([0-9]{1,})/([0-9a-zA-Z-]{1,})$ http://www.dreamflowershouston.com/products/$1/$2-flowers [R=301,L]

RewriteRule ^faq.php$ /testimonials.php [R=301,L]

RewriteRule ^products/details/58/Robaxin-Methocarbamol$ robaxin-methocarbamol-58 [R=301,L]

*********redirect directory********
Redirect /gotsolution/index.htm http://localhost/gotsolution/swedish/

https redirection
RewriteCond %{HTTP_HOST} !^www\.riceinfo\.in [NC] RewriteRule ^(.*)$ https://www.riceinfo.in/$1 [L,R=301] RewriteCond %{REQUEST_URI} ^/index.php$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/ [R=301,L]

all site redirect http to https
RewriteCond %{HTTPS} off
RewriteCond %{ENV:IS_HTTP} !1
#RewriteCond %{HTTP_HOST} !^www\.sitename\.com [NC] RewriteRule ^(.*)$ https://www.sitename.com/$1 [L,R=301]

RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.searchbabu.com/$1 [L,R=301] RewriteCond %{REQUEST_URI} ^/home$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/ [R=301,L]

//folder image or other not read
RewriteRule ^(.*).php/(.*)$ http://www.pureherbalayurved.com.au/404.php [R=404,L]

rewritecond %{http_host} ^sleepingtabletsonlineshop.com [nc] rewriterule ^(.*)$ http://www.sleepingtabletsonlineshop.com/$1 [r=301,nc] RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

//htaccess not efeect below
RewriteCond $1 !^(index\.php|includes/plugins/fckeditor)
RewriteRule ^(.*)\.html$ $1.php [nc]

redirection
RewriteRule ^index.php.*$ http://www.zolbien.com/ [R=301,L]

// name feching record url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ location.php?id=$1 [QSA,L]

//stop sttps open
RewriteCond %{HTTPS} off

AddType application/x-httpd-php5 .htm .html .shtml
RewriteEngine on

//window show save remove
AddType application/x-httpd-php5 .htm .html .php .php5 .php4 .php .php3 .php2 .phtml
DirectoryIndex index.php index.htm index.html

AddHandler application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php-source .phps
AddHandler php5-script .php

**********************// htaccess code remove page or home ***************
RewriteCond %{REQUEST_URI} ^/pages(.*)$
RewriteRule ^pages\/(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

//router code remove page or home
$module_dir = FCROOT . ‘modules’;
$dirs = glob($module_dir.’/*’,GLOB_ONLYDIR);
foreach($dirs as $dir)
{
$controller_name=( str_replace($module_dir.’/’,”,$dir));
if($controller_name!=’pages’)
$route[“$controller_name(.htm)?(.*)”] = “$controller_name$2″;
}

if(file_exists(FCPATH.’modules/seo_routes.php’))
include(FCPATH.’modules/seo_routes.php’);

$route[‘([a-zA-Z_-]*)(.htm)?’] = ‘pages/$1′;

//allow to run file
RewriteCond $1 !^(index\.php|uploaded|assets|img_cache|html|robots\.txt|sitemap\xml)

RewriteCond %{HTTP_HOST} ^globalpapertrade\.com [NC] RewriteRule ^(.*)$ http://www.globalpapertrade.com/$1 [L,R=301] # access reade file permission
RewriteCond $1 !^(index\.php|uploaded|assets|img_cache|robots\.txt|sitemap\.xml|googleb34e17f5e3718e4e\.html)

//if any folder htaccess use
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.htm$ template/$1.htm
RewriteCond %{REQUEST_URI} ^/main(.*)$
RewriteRule ^main\/(.*)$ https://www.myathleticprofile.com/$1 [R=301,L]

// not file name and folder effect htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*).php$ apps/$1.php
RewriteCond %{REQUEST_FILENAME} !ipopeng.htm

RewriteRule ^category_([^/]+)_([^/]+)\.html$ category_listing.php?category_id=$2

RewriteRule ^visityuorwebsite_([^/]+)_([^/]+)_([^/]+)_([^/]+)_([^/]+)\.html$ product_details.php?product_id=$2&member_id=$3&action_website=$4&website_url=$5
RewriteRule ^product_details\.html$ product_details.php
RewriteRule ^faq\.html$ faq.php
RewriteRule ^login\.html$ login.php
RewriteRule ^productdetail_([^/]+)_([^/]+)\.html$ product_details.php?product_id=$2
RewriteRule ^featured-machine-details-([^/]+)_([^/]+)\.html$ featured_machine_details.php?session_id=$1&machine_id=$2
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)/(.*)/(.*)/$ /$1.php?$2=$3
RewriteRule ^Allproducts_([^/]+)\.html$ product_listing.php?product_type=$1
RewriteRule ^newsdetail_([^/]+)_([^/]+)\.html$ news-dtl.php?news_id=$2

#RewriteRule ^morenews\.html$ news.php

#RewriteRule ^categorylisting\.html$ category_listing.php
RewriteRule ^view_product_([^/]+)_([^/]+)\.html$ view_product_details.php?product_id=$2
RewriteRule ^product_([^/]+)_([^/]+)\.html$ product_listing.php?category_id=$2
RewriteRule ^viewother_([^/]+)_([^/]+)_([^/]+)\.html$ product_listing.php?product_id=$2&member_id=$3
RewriteRule ^printthisimage_([^/]+)_([^/]+)_([^/]+)_([^/]+)\.html$ product_details.php?product_id=$2&member_id=$3&action_print=$4
RewriteRule ^referfriend_([^/]+)_([^/]+)_([^/]+)\.html$ refer_friend.php?product_id=$2&member_id=$3
RewriteRule ^contact_dealer_([^/]+)_([^/]+)\.html$ contact_dealer.php?member_id=$2

RewriteRule ^sendInquiry_([^/]+)_([^/]+)_([^/]+)\.html$ send_enquiry.php?product_id=$2&member_id=$3

RewriteRule ^read_([^/]+)_([^/]+)\.html$ pro-readmore.php?catid=$2
RewriteRule ^view_([^/]+)_([^/]+)\.html$ pro-cat.php?catid=$2

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*).php$ apps/$1.php
#RewriteCond %{REQUEST_FILENAME} !ipopeng.htm

RewriteRule ^(.*).htm$ apps/$1.php

RewriteRule ^pro_sub_([^/]+)_([^/]+)\.htm$ product-subcat.php?pid=$1
RewriteRule ^pro_list_([^/]+)_([^/]+)\.htm$ product-listing.php?pid=$1
RewriteRule ^details_([^/]+)_([^/]+)_([^/]+)\.htm$ product-details.php?pid=$1&id=$2

# other type htaccess use
RewriteCond $1 !/.
RewriteRule ^([0-9]+)/([^/]+)\.htm$ article-detail.php?id=$1

RewriteRule ^res_det-([^/]+)-([^/]+)\.htm$ resource-detail.php?id=$1

RewriteRule ^([^/]+)-Category\.htm$ product-categories.php?htmName=$1

RewriteRule ^([^/]+)-Products\.htm$ product-listing.php?htmName=$1

RewriteRule ^([^/]+)-Details\.htm$ product-details.php?htmName=$1
RewriteRule ^product.rss$ rss_feed.php
RewriteCond $1 !/.
RewriteRule ^(.*)\.htm$ $1.php [L]

#end

# prem sir create htaccess

RewriteRule ^contact_us\.htm$ contact_us.php
RewriteRule ^newsletter\.htm$ newsletter.php
RewriteRule ^feedback\.htm$ feedback.php
RewriteRule ^refer_friend\.htm$ refer_friend.php
RewriteRule ^sitemap\.htm$ sitemap.php
RewriteRule ^trade_alert\.htm$ trade_alert.php
RewriteRule ^post_buy_tradeleads\.htm$ post_buy_tradeleads.php
RewriteRule ^post_sell_tradeleads\.htm$ post_sell_tradeleads.php
RewriteRule ^post_buy_services\.htm$ post_buy_services.php
RewriteRule ^post_sell_services\.htm$ post_sell_services.php
RewriteRule ^manage_tradeleads\.htm$ manage_tradeleads.php
RewriteRule ^received_enquiries\.htm$ received_enquiries.php
RewriteRule ^sent_enquiries\.htm$ sent_enquiries.php
RewriteRule ^edit_account\.htm$ edit_account.php
RewriteRule ^change_password\.htm$ change_password.php
RewriteRule ^my_catalogue\.htm$ my_catalogue.php
RewriteRule ^my_favourites\.htm$ my_favourites.php
RewriteRule ^my_advertisement\.htm$ my_advertisement.php
RewriteRule ^categories\.htm$ categories.php
RewriteRule ^buy_categories\.htm$ buy_categories.php
RewriteRule ^sell_categories\.htm$ sell_categories.php
RewriteRule ^forgot_password\.htm$ forgot_password.php
RewriteRule ^membership_benefits\.htm$ membership_benefits.php
RewriteRule ^thanks\.htm$ thanks.php
RewriteRule ^advertisement\.htm$ advertisement.php
RewriteRule ^make_payment\.htm$ make_payment.php
RewriteRule ^upload_banner\.htm$ upload_banner.php
RewriteRule ^logout\.htm$ logout.php

RewriteRule ^companies/([^/]+)/([^/]+)\.htm$ companies_listing.php?category_id=$1
RewriteRule ^company/([^/]+)/([^/]+)\.htm$ company_details.php?company_id=$1
RewriteRule ^catalogue/([^/]+)/([^/]+)\.htm$ company_catalogue.php?company_id=$1

RewriteRule ^buyleads/([^/]+)/([^/]+)\.htm$ buy_leads_listing.php?category_id=$1
RewriteRule ^buylead/([^/]+)/([^/]+)\.htm$ buy_lead_details.php?entity_id=$1

RewriteRule ^sellleads/([^/]+)/([^/]+)\.htm$ sell_leads_listing.php?category_id=$1
RewriteRule ^selllead/([^/]+)/([^/]+)\.htm$ sell_lead_details.php?entity_id=$1

RewriteRule ^buyservices/([^/]+)/([^/]+)\.htm$ buy_services_listing.php?category_id=$1
RewriteRule ^buyservice/([^/]+)/([^/]+)\.htm$ buy_service_details.php?entity_id=$1

RewriteRule ^sellservices/([^/]+)/([^/]+)\.htm$ sell_services_listing.php?category_id=$1
RewriteRule ^sellservice/([^/]+)/([^/]+)\.htm$ sell_service_details.php?entity_id=$1

RewriteRule ^news/([^/]+)/([^/]+)\.htm$ news_details.php?news_id=$1

#end

# floder page htaccess code
RewriteRule ^index\.htm$ index.php [L] RewriteRule ^pages/aboutus\.htm$ pages/aboutus.php [L]

RewriteRule ^pages/services\.htm$ pages/services.php [L]

RewriteRule ^member/login\.htm$ member/login.php [L]

RewriteRule ^member/register\.htm$ member/register.php [L]

RewriteRule ^pages/support\.htm$ pages/support.php [L]

RewriteRule ^pages/contactus\.htm$ pages/contactus.php [L]

RewriteRule ^pages/sitemap\.htm$ pages/sitemap.php [L]

RewriteRule ^product/advanced-search\.htm$ product/advanced-search.php [L]

RewriteRule ^pages/newsletter\.htm$ pages/newsletter.php [L]

#end

RewriteRule ^pro_([^/]+)_domestic\.htm$ domestic.php?pid=$1
RewriteRule ^pro_([^/]+)_commercial\.htm$ commercial.php?pid=$1
RewriteRule ^pro_([^/]+)_rural\.htm$ rural.php?pid=$1
RewriteRule ^pro_([^/]+)_industrial\.htm$ industrial.php?pid=$1

RewriteBase /
RewriteRule ^(.*).htm$ apps/$1.php

RewriteRule ^product/([^/]+)/([^/]+)$ apps/pro-listing.php?pid=$1 [NC]

RewriteRule ^subcategory/([^/]+)/([^/]+)$ apps/subcategory.php?pid=$1 [NC]

RewriteRule ^productDetail/([^/]+)/([^/]+)/([^/]+)$ apps/pro-dtl.php?pid=$1&cid=$2 [NC]

#RewriteRule ^(.*).htm$ apps/$1.htm

page use code

$cglink=”productdetail_”.$cnme1.’_’.$pcat_id.’.html’;

***********joomla psd************************

RewriteEngine On
Options +FollowSymlinks
RewriteRule ^(PD/([^/]+)/([^/]+)/*) index.php?page=shop.product_details&flypage=shop.flypage&product_id=$2&category_id=$3&manufacturer_id=0&option=com_virtuemart&Itemid=150 [NC] RewriteRule ^(PRODUCTS/*) index.php?option=com_virtuemart&page=shop.browse&category_id=7&Itemid=156 [NC] RewriteRule ^(PRIVATE-LABELING/*) index.php?option=com_content&task=view&id=21&Itemid=52 [NC] RewriteRule ^(QUALITY-CONTROL/*) index.php?option=com_content&task=view&id=23&Itemid=54 [NC] RewriteRule ^(SHIPPING/*) index.php?option=com_content&task=view&id=24&Itemid=55 [NC] RewriteRule ^(ORDERING/*) index.php?option=com_content&task=view&id=25&Itemid=56 [NC] RewriteRule ^(Home/*) index.php? [NC] RewriteRule ^(Specials/*) index.php?option=com_content&task=view&id=41&Itemid=9 [NC] RewriteRule ^(Contacts/*) index.php?option=com_content&task=view&id=27&Itemid=9 [NC] RewriteRule ^(Resources/*) index.php?option=com_content&task=view&id=45&Itemid=9 [NC] RewriteRule ^(FAQ/*) index.php?option=com_content&task=view&id=28&Itemid=9 [NC] RewriteRule ^(PrivacyPolicy/*) index.php?option=com_content&task=view&id=42&Itemid=9 [NC]

//function that use name change underscore

function GetValidFileName2($fname){//htaccess naming
$pattern=”[?() ??’\”\/&#\,\;\:\.$]”;
$valid_file=preg_replace(“/$pattern/”,”_”,$fname);
$valid_file=preg_replace(“/[_ ]+/”,”_”,$valid_file);
$valid_file=strtolower($valid_file);
return $valid_file;
}

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.barterstationery.com$ [NC] RewriteRule ^(.*)$ http://www.barterstationery.com/$1 [L,R=301] #RewriteRule ^category/(.*)-(.*)\.htm$ category_listing.php?category_id=$2 [L] RewriteRule ^product-(.*)-(.*)\.htm$ product-listing.php?catID=$2 [L] RewriteRule ^category-(.*)-(.*)\.htm$ product-subcate.php?catID=$2 [L]

RewriteRule ^detail-(.*)-(.*)\.htm$ product-details.php?productID=$2 [L] RewriteRule ^index\.htm$ index.php

whate file you want show directory first

DirectoryIndex home.php index.php

// html creation
function get_url2($ID,$Name,$prefix){

$retun_page= SITE_URL.”/”.GetValidFileName2($Name).”-“.$ID.”-“.$prefix.”.htm”;

return $retun_page;
}

function get_url($ID,$Name,$prefix){

$retun_page= SITE_URL.”/”.$prefix.”-“.GetValidFileName2($Name).”-“.$ID.”.htm”;

return $retun_page;
}
function get_url_double($ID,$SID,$Name,$prefix){

$retun_page= SITE_URL.”/”.$prefix.”-“.GetValidFileName2($Name).”-“.$ID.”-“.$SID.”.htm”;

return $retun_page;
}
function get_url_detail($ID,$Name){
$retun_page= SITE_URL.”/”.GetValidFileName2($Name).”-“.$ID.”.htm”;

return $retun_page;

}
function GetValidFileName2($fname){//htaccess naming
$fname=trim($fname);
$valid_file=preg_replace(‘/[?() ??\’\”\/&#\,\;\:\.$]/’,”-“,$fname);
$valid_file=strtolower($valid_file);
$valid_file=str_replace(“–“,”-“,$valid_file);
$valid_file=str_replace(“>”,””,$valid_file);
$valid_file=str_replace(“<“,””,$valid_file);
$valid_file=str_replace(“=”,”-“,$valid_file);
$valid_file=str_replace(“‘”,”-“,$valid_file);
$valid_file=str_replace(‘”‘,”-“,$valid_file);
$valid_file=str_replace(“~”,”-“,$valid_file);
$valid_file=str_replace(“^”,”-“,$valid_file);
$valid_file=str_replace(“@”,””,$valid_file);
$valid_file=str_replace(“!”,”-“,$valid_file);
$valid_file=str_replace(“&”,”-“,$valid_file);
$valid_file=str_replace(“*”,”-“,$valid_file);
$valid_file=str_replace(“+”,”-“,$valid_file);
$valid_file=str_replace(“?”,”-“,$valid_file);
$valid_file=str_replace(“(“,””,$valid_file);
$valid_file=str_replace(“)”,””,$valid_file);
$valid_file=str_replace(“,”,”-“,$valid_file);
$valid_file=str_replace(“:”,”-“,$valid_file);
$valid_file=str_replace(“;”,”-“,$valid_file);
$valid_file=str_replace(“$”,”-“,$valid_file);
$valid_file=str_replace(“#”,”-“,$valid_file);
$valid_file=str_replace(“%”,”-“,$valid_file);
$valid_file=str_replace(“__”,”-“,$valid_file);
$valid_file=str_replace(“__”,”-“,$valid_file);
$valid_file=str_replace(“__”,”-“,$valid_file);
$valid_file=str_replace(“.”,””,$valid_file);
$valid_file=str_replace(“–“,”-“,$valid_file);
$valid_file=str_replace(“|”,””,$valid_file);
if(substr($valid_file,-1)==’-‘)
{
$valid_file=substr($valid_file,0,-1);
//echo $valid_file;
}
return strtolower($valid_file);
}

//sequre ftp redirect
rewritecond %{http_host} ^sitename.com [nc] rewriterule ^(.*)$ https://www.sitename.com/$1 [r=301,nc] RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

any file data writing
$dataVal=”d.add(‘”.$cat_id.”‘, ‘”.$cat_parent.”‘,'”.count_character($cat_name,18).”‘,'”.get_url_by_cat($cat_id,$cat_name,’pro-‘).”‘,'”.$cat_name.”‘);”;

$dataVal.=”\n”;
$dataVal.=” document.write(d);”;
$fp = fopen(SITE_FS_PATH.”/make.js”, “w+”);
fwrite($fp,$dataVal);
//************************************important file path open site************************************************************
authUserFile /var/www/vhosts/ektamandirarizona.org/httpdocs/cpanel/.htpasswd
AuthGroupFile /dev/null
AuthName “ektamandirarizona.org”
AuthType Basic
<Limit GET PUT POST>
require user ekta
</Limit>

//.htpasswd file data is
ekta:$apr1$b/o4vDP6$LHBfLJ4rxb5kxbp9Ws4t01

this username ekta and pass ekta

//tour site htaccess
RewriteCond %{HTTP_HOST} (www.)?chinasilkroadtours.com$
RewriteRule ^(.*)$ http://www.uighurtour.com/$1 [R=301,L]

RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

AddType application/x-httpd-php5 .php .html .htm
DirectoryIndex index.html index.htm index.php
#php_flag magic_quotes_gpc on
# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
#AuthName dominicknight.co.uk
#AuthUserFile /home/dominic/public_html/_vti_pvt/service.pwd
#AuthGroupFile /home/dominic/public_html/_vti_pvt/service.grp

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.dominicknight.co.uk$ [NC] RewriteRule ^(.*)$ http://www.dominicknight.co.uk/$1 [L,R=301] RewriteRule ^blog-(.*)-(.*)\.html$ blog.php?catID=$2 [L] RewriteRule ^cat-(.*)-(.*)\.html$ pro-cat1.php?catid=$2 [L] RewriteRule ^sub-(.*)-(.*)-(.*)\.html$ products.php?mcatid=$2&catid=$3 [L] RewriteRule ^det-(.*)-(.*)\.html$ product-detail.php?product_id=$2 [L] RewriteRule ^treatment-(.*)-(.*)\.html$ treatment.php?id=$2 [L]

#New by HC this code is dominicknight.co.uk
Redirect 301 /phobia.php http://www.dominicknight.co.uk/treatment-Phobias-1.html
Redirect 301 /depression.php http://www.dominicknight.co.uk/treatment-Depression-9.html
Redirect 301 /bulimia.php http://www.dominicknight.co.uk/treatment-Bulimia-8.html
Redirect 301 /ocd.php http://www.dominicknight.co.uk/treatment-OCD-10.html
Redirect 301 /weight-loss.php http://www.dominicknight.co.uk/treatment-Weight_Loss-7.html
Redirect 301 /panic-attacks.php http://www.dominicknight.co.uk/treatment-Panic_Attacks-15.html
Redirect 301 /public-speaking.php http://www.dominicknight.co.uk/treatment-Public_Speaking-4.html
Redirect 301 /fear-flying.php http://www.dominicknight.co.uk/treatment-Fear_of_Flying-5.html
Redirect 301 /sports-enhancement.php http://www.dominicknight.co.uk/treatment-Sports_Enhancement-6.html
Redirect 301 /d_secrets.php http://www.dominicknight.co.uk/treatment-Panic_Attacks-15.html
//second type
RewriteRule ^list/injection-list-27.htm.*$ http://www.rptraders.com/pro-dtl.php?id=23 [R=301,L] RewriteRule ^list/list-30.htm.*$ http://www.rptraders.com/pro-dtl.php?id=28 [R=301,L] RewriteRule ^list/anti-cancer-list-33.htm.*$ http://www.rptraders.com/pro-dtl.php?id=30 [R=301,L] RewriteRule ^list/all-products-list-72.htm.*$ http://www.rptraders.com/pro-dtl.php?id=200[R=301,L]

// page not found code
ErrorDocument 404 /pagenotfound.php
or
Options +FollowSymlinks
ErrorDocument 404 http://ganeshatravels.com//index.php
Options All -Indexes

/// safe wordpress blog haker ip baned
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName “Access Control”
AuthType Basic
order deny,allow
deny from all
# whitelist home IP address
allow from 64.233.169.99
# whitelist work IP address
allow from 69.147.114.210
allow from 199.239.136.200
# IP while in Kentucky; delete when back
allow from 128.163.2.27

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com – http://www.prestashop.com/forums

# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg [L,E] RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [L,E] RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$3&isolang=$1$5 [L,E] RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang=$1$4 [L,E] RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$2&isolang=$1 [QSA,L,E] RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [L,E] RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [L,E] RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L,E] RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E] RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 [QSA,L,E] RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E] RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E]

# Catch 404 errors
ErrorDocument 404 /404.php

router

$route[‘(:any)-(cat-(:num))’] = “ads/index/$3”;
$route[‘(:any)-(cat-(:num))/(pages)’] = “ads/index/$3/$4”;
$route[‘(:any)-(cat-(:num))/pages/(:num)’] = “ads/index/$3/$4”;

$route[‘(:any)-(subcat-(:num))’] = “category/index/$3”;
$route[‘(:any)-(subcat-(:num))/pages/(:num)’] = “category/index/$3/$4”;

$route[‘(:any)-(:num)’] = “ads/detail/$2″;

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

RewriteCond $1 !^(index\.php|assets|uploaded_files|fck|img_cache|system|jscal|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_URI} ^/pages(.*)$
RewriteRule ^pages\/(.*)$ http://%{HTTP_HOST}/$1 [R=301,L] and it router file is

$route[‘sitepanel(.*)’] = ‘sitepanel$1’; // Anything that starts with ‘sitepanel’ remains the same
$route[‘athlete(.*)’] = ‘athlete$1’; // Anything that starts with ‘athlete’ remains the same
$route[‘coach(.*)’] = ‘coach$1’; // Anything that starts with ‘coach’ remains the same
$route[‘payment(.*)’] = ‘payment$1’; // Anything that starts with ‘payment’ remains the same
$route[‘(.*)’] = ‘main/$1’; // Anything else is redirected to main/..

//smarty htaccess
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com – http://www.prestashop.com/forums

# URL rewriting module activation
RewriteEngine on

#RewriteCond %{THE_REQUEST} ^.*/index.php
#RewriteRule ^(.*)index.php$ http://www.ledlightdepot.co.uk/$1 [R=301,L]

#rewritecond %{http_host} ^ledlightdepot.co.uk [nc] #rewriterule ^(.*)$ http://www.ledlightdepot.co.uk/$1 [r=301,nc]

# URL rewriting rules
RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg [L,E] RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [L,E] RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$3&isolang=$1$5 [L,E] RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang=$1$4 [L,E] RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$2&isolang=$1 [QSA,L,E] RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [L,E] RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [L,E] RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L,E] RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E] RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 [QSA,L,E] RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E] RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E]

# Catch 404 errors
ErrorDocument 404 /404.php

RewriteCond %{REQUEST_URI} ^shopping_cart.php$
RewriteRule ^(.*)$ https://www.buydebest.com/$1 [R,L]

RewriteCond %{REQUEST_URI} ^checkout.php$ [NC] RewriteRule ^(.*)$ https://www.buydebest.com/$1 [R,L]

RewriteCond %{REQUEST_URI} ^order_review.php$
RewriteRule ^(.*)$ https://www.buydebest.com/$1 [R,L]

RewriteCond %{REQUEST_URI} ^payment.php$
RewriteRule ^(.*)$ https://www.buydebest.com/$1 [R,L]

#RewriteCond %{REQUEST_URI} ^email_login.php$
#RewriteRule ^(.*)$ https://www.buydebest.com/$1 [R,L,QSA]

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteBase /

#php_value upload_max_filesize 50M
#php_value post_max_size 50M
RewriteCond $1 !^(index\.php|assets|uploaded_files|img_cache|system|jscal|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]

RewriteCond %{http_host} ^justfriendchat.com [nc] RewriteRule ^(.*)$ http://www.justfriendchat.com/

</IfModule>

<?
if(basename($_SERVER[‘PHP_SELF’])==’index.php’ or basename($_SERVER[‘PHP_SELF’])==’index.html’ or basename($_SERVER[‘PHP_SELF’])==’index.htm’)
{
echo ‘
<link rel=”canonical” href=”http://www.americanpricemark.com” />’;
}
?>

one line content
<h1 style=”float:left;”>American Limo Chicago</h1> <span style=”width:60%px; float:left; color:#FAD81C; margin-left:3px; font-size:15px;” >-Welcome to American Limousine Charters – Chicago Limo Service</span>

//spam mail abstract
function checkHTTPREFERER() {
$baseurl=SITE_URL_PATH;
$referer=$_SERVER[‘HTTP_REFERER’];
$srch=$_SERVER[‘HTTP_HOST’];

if(!strstr($referer,$srch)) {
?>
<html>
<head><title>Error</title>

function open_Window() {
win = window.open(“/error.php?id=error”,””,”width=480,height=40,top=0,left=0″);
}

</head>
<body bgcolor=”#ffffff” text=”#000000″ link=”#0066FF” vlink=”#666EB3″ alink=”#003399″ onLoad=”open_Window()”>
</body>
</html>
<?php
exit;
}
}

$route[‘default_controller’] = “home”;

$route[‘404_override’] = ”;

$module_dir = FCROOT . ‘modules’;
$dirs = glob($module_dir.’/*’,GLOB_ONLYDIR);
foreach($dirs as $dir)
{
$controller_name=( str_replace($module_dir.’/’,”,$dir));
if($controller_name!=’pages’)
$route[“$controller_name(.htm)?(.*)”] = “$controller_name$2”;
}

if(file_exists(FCPATH.’modules/seo_routes.php’))
include(FCPATH.’modules/seo_routes.php’);

$route[‘([a-zA-Z_-]*)(.htm)?’] = ‘pages/$1′;

var replaced = $(“body”).html().replace(/pages\//g,”);
$(“body”).html(replaced);

sco.php file

<?php
class seo extends CI_Controller {

public function __construct()
{
parent::__construct();
}

public function write_static_rules()
{
ob_start();
$module=$this->uri->segment(4);
if(file_exists(FCPATH.”modules/$module/controllers/$module”.’.php’) && $module!=”)
{
include(FCPATH.”modules/$module/controllers/$module”.’.php’);
$methods=get_class_methods(“$module”);
foreach($methods as $method)
{
if(!in_array($method,array(‘__construct’,’index’,’get_instance’)))
{
echo ‘<br>$’.”route[‘(“.$method.”)(.htm)?’]= ‘”.$module.”/$1′”;
}
}
}

}

}
// End of controller

Options +FollowSymLinks
RewriteEngine On
#RewriteBase /indianmart.co.uk/
RewriteBase /

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-(.*).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-by-(.*).html$ all-products.php?fl=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-(.*).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-au-(.*).html$ articles.php?authors_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-(.*).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-(.*).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-f-(.*).html$ faqdesk_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fc-(.*).html$ faqdesk_index.php?faqPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fri-(.*).html$ faqdesk_reviews_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fra-(.*).html$ faqdesk_reviews_article.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-(.*).html$ information.php?info_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-n-(.*).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nc-(.*).html$ newsdesk_index.php?newsPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nri-(.*).html$ newsdesk_reviews_info.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nra-(.*).html$ newsdesk_reviews_article.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-po-([0-9]+).html$ pollbooth.php?pollid=$2&%{QUERY_STRING}

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301] RewriteCond %{REQUEST_URI} ^/index.php
RewriteRule ^(.*)$ http://%{HTTP_HOST}/ [R=301,L]

<Limit GET POST HEAD>
Order Allow,Deny
Allow from all

# Cyveillance
deny from 38.100.19.8/29
deny from 38.100.21.0/24
deny from 38.100.41.64/26
deny from 38.105.71.0/25
deny from 38.105.83.0/27
deny from 38.112.21.140/30
deny from 38.118.42.32/29
deny from 65.213.208.128/27
deny from 65.222.176.96/27
deny from 65.222.185.72/29

Deny from env=bad_bot
</Limit>

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 46.73.137.220
deny from 157.55.116.42
deny from 62.231.141.193

Options +FollowSymlinks
ErrorDocument 404 http://yourdigitalsources.com/404.php
Options All -Indexes

#Prevent Direct Access to files

<FilesMatch “\.(tpl|ini|includes|classes|languages|themes|img_cache)”>

Order deny,allow
Deny from all

</FilesMatch>

# Stop people accessing various directories

<IfModule mod_alias.c>

RedirectMatch 403 ^/apps/?$
RedirectMatch 403 ^/config/.*?/?

</IfModule>

#SEO URL Settings

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteBase /

#Static page Rewrite#

RewriteRule ^index.htm$ index.php [L] RewriteRule ^aboutus.htm$ controller.php?route=apps/pages/aboutus.php [L] RewriteRule ^sizechart.htm$ controller.php?route=apps/pages/sizechart.php [L] controller.php?route=apps/myaccount/logout.php [L]

</IfModule>

spam mail restrict look http://www.smallmoving.co.uk/get-free-quote.htm

or set mail function return path
function send_email($fromPerson, $fromEmail, $to, $subject, $message){
$headers = “From: $fromPerson<$fromEmail> \n”;
$headers .= “Reply-To: $eMail \r\n”;
$headers .= “X-Mailer: PHP/”. phpversion();
$headers .= “Return-Path: “.'<‘.$fromEmail.”> \r\n”;

$headers .= “X-Priority: 3 \n”;
$headers .= “MIME-version: 1.0\n”;
$headers .= “Content-Type: text/html; charset=UTF-8\n”;
$msg=$message;
@mail($to, $subject, $msg, $headers);
}

//<![CDATA[
.
.
.
//]]

if basepath not define in project add this code below start header
<base href=”<?php echo $baseurl;?>/” />

DocumentRoot “C:Site”
ServerName http://www.mysite.com

RewriteEngine On
<Directory “C:\Site”>
Order allow,deny
Allow from all

RewriteCond $1 (^/images/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /admin$1 [QSA,L] </Directory>

metatag add ci project

$this->load->model(array(“Pages_model”));
$pageurl= $this->uri->uri_string;
$meta_tag=$this->Pages_model->get_metatag($pageurl);
print_r($meta_tag);

if(!isset($meta_tag))$meta_tag=””;
if(is_array($meta_tag)){
echo ‘<title>’.$meta_tag[‘page_title’].'</title>’;
echo “<meta name=’description’ content='”.$meta_tag[‘page_description’].”‘ />”;
echo “<meta name=’keywords’ content='”.$meta_tag[‘page_keywords’].”‘ />”;
}else{
echo ‘<title>Welcome to Find A work</title>’;
echo “<meta name=’description’ content=’Welcome to Find A work’ />”;
echo “<meta name=’keywords’ content=’Welcome to Find A work’ />”;
}
?>

look history of website

http://web.archive.org

Give this a try:

RewriteCond %{HTTP_HOST} ^de\.domain\.de$ [NC] RewriteCond %{REQUEST_URI} ^(.*)/en/(.*)$ [NC] RewriteRule ^(.*)$ http://%{HTTP_HOST}/targetpage.php [R=301,L]

# Add a trailing slash to paths without an extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1/ [L,R=301] or
RewriteRule ^01-chapter1.html(#.+)?$ /section1/chapter-1/$1 [R=301,NE]

RewriteEngine On
RewriteBase /
RewriteRule ^products/([0-9a-zA-Z\_\-]*)\.htm([l]?)$ index.php?p=product&product_code=$1&%{QUERY_STRING} [L] RewriteRule ^catalog/([0-9a-zA-Z\_\-]*)\.htm([l]?)$ index.php?p=catalog&catalog_code=$1&%{QUERY_STRING} [L] RewriteRule ^pages/([0-9a-zA-Z\_\-]*)\.htm([l]?)$ index.php?p=page&page_id=$1&%{QUERY_STRING} [L] RewriteRule ^index\.htm([l]?)$ index.php?p=home&%{QUERY_STRING} [L] RewriteRule ^site_map\.htm([l]?)$ index.php?p=site_map&%{QUERY_STRING} [L]

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4
Options -MultiViews

RewriteEngine On
RewriteBase /
ErrorDocument 404 /error.php

RewriteCond %{HTTP_HOST} ^equityoverseas\.com$
RewriteRule ^(.*) http://www.equityoverseas.com/$1 [R=301]

#RewriteRule ^([0-9]/*.*)$ propertydetails.php?id=$1 [L]

RewriteRule (.*)propertyimage/(.*) $1thumb.php?x=650&y=414&q=70&imf=properties/&src=$2 [QSA,L] RewriteRule (.*)thumbnail/(.*) $1thumb.php?x=88&y=66&q=70&imf=properties/&src=$2 [QSA,L]

RewriteCond %{REQUEST_URI} !property\.php
RewriteRule ^property(.*)$ propertydetails.php?$1 [L]

RewriteRule ^(buy*)$ properties.php?a=1&$1 [L]

RewriteRule ^(rent*)$ properties.php?a=2&$1 [L] RewriteRule ^(invest*)$ properties.php?a=3&$1 [L] RewriteRule ^(mortgage*)$ properties.php?a=4&$1 [L] RewriteRule ^(sell*)$ myaccount.php?open=create&a=5&$1 [L]

RewriteRule ^buy/(.*)$ properties.php?a=1&type=$1 [L] RewriteRule ^sale/(.*)$ properties.php?a=1&type=$1 [L] RewriteRule ^rent/(.*)$ properties.php?a=2&type=$1 [L] RewriteRule ^invest/(.*)$ properties.php?a=3&type=$1 [L] RewriteRule ^mortgage/(.*)$ properties.php?a=4&type=$1 [L] RewriteRule ^(myaccount*)$ myaccount.php?open=$1 [L] #RewriteRule ^news(.*)$ news.php?$1 [L] RewriteCond %{REQUEST_URI} !search\.php
RewriteRule ^search(.*)$ search.php?$1 [L] RewriteRule (.*)newimage/(.*) $1thumb.php?x=120&y=120&imf=shahkotadmin/attachments/&src=$2
RewriteRule (.*)newsimage/(.*) $1thumb.php?x=80&y=80&imf=shahkotadmin/attachments/&src=$2
RewriteRule (.*)bigimage/(.*) $1thumb.php?x=820&y=820&imf=shahkotadmin/attachments/&src=$2 [QSA,L] RewriteRule (.*)smallads/(.*) $1thumb.php?x=90&y=90&imf=ads/&src=$2 [QSA,L] RewriteRule (.*)mediumads/(.*) $1thumb.php?x=150&y=150&imf=ads/&src=$2 [QSA,L] RewriteRule (.*)homeads/(.*) $1thumb.php?x=280&y=250&imf=ads/&src=$2 [QSA,L] RewriteRule (.*)propertyemails/(.*) $1thumb.php?x=248&y=187&imf=properties/&src=$2 [QSA,L] RewriteRule ^(.*)(.html)$ pages.php?id=$1 [L]

routing rule
$route[‘(:any)-products-(\d+)’] = “products/index/$2”;
$route[‘(:any)/(:any)-(\d+)’] = “products/details/$3”;
$route[‘(:any)-(\d+)’] = “categories/listing/$2”;

$route[‘trade_articles/(:num)(/pages/(:num))?(/(:any))?’] = ‘trade_articles/index/$1’;

$route[‘classifieds/([a-z]+(:any))(/pages/(:num))?(/(:any))?’] = ‘classifieds/country/$1’;
$route[‘classifieds/([a-z]+(:any))/pages’] = ‘classifieds/country/$1’;

$route[‘clear_cache(.*)’] = ‘clear_cache$1’; // Anything that starts with ‘sitepanel’ remains the same
$route[‘sitepanel(.*)’] = ‘sitepanel$1’; // Anything that starts with ‘sitepanel’ remains the same
$route[‘athlete_(.*)’] = ‘main/athlete_$1’; // Anything that starts with ‘athlete’ remains the same
$route[‘athletes(.*)’] = ‘main/athletes$1’; // Anything that starts with ‘athlete’ remains the same
$route[‘coaches(.*)’] = ‘main/coaches$1’; // Anything that starts with ‘coach’ remains the same

$route[‘athlete(.*)’] = ‘athlete$1’; // Anything that starts with ‘athlete’ remains the same
$route[‘coach(.*)’] = ‘coach$1’; // Anything that starts with ‘coach’ remains the same
$route[‘payment(.*)’] = ‘payment$1’; // Anything that starts with ‘payment’ remains the same

$route[‘payment(.*)’] = ‘payment$1’; // Anything that starts with ‘payment’ remains the same
$route[‘seo(.*)’] = ‘seo$1’; // Anything that starts with ‘payment’ remains the same

$route[‘^([A-z0-9-]+)/(category|products)/([0-9]+)(/[a-zA-Z0-9-\/]+)?$’] = “$2/index/$3$4”;
$route[‘^([A-z0-9-]+)/(prod-details)/([0-9]+)(/[a-zA-Z0-9-\/]+)?$’] = “products/detail/$3$4”;
$route[‘^appreciation(/[a-zA-Z0-9-\/]+)?$’] = “testimonials$1”;

ci 404 page
<IfModule !mod_rewrite.c>
ErrorDocument 404 /pages/page_not_found
</IfModule>

//http:// to https://
RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^sharmagoa\.com$ [NC] RewriteRule ^ https://www.sharmagoa.com%{REQUEST_URI} [L,R=301] #RewriteRule ^index\.htm$ index.php
RewriteCond %{HTTP_HOST} !^www\.sharmagoa\.com [NC] RewriteRule ^(.*)$ https://www.sharmagoa.com/$1 [L,R=301] RewriteCond %{REQUEST_URI} ^/index.php$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/ [R=301,L]