How To Create Clean URL By HTACCESS

hi friends, today I will tell you how you can clean URL in PHP by .htaccess file. This is a redirect engine that redirect your URL to applied conditions.

simply our PHP project URL contains ( ? = / ) these type of special characters. This type of character is bad for google index. Your SEO score can go down how to escape this type of situation.

Example : 1

Beforewww.example.com/item.php?product=2
Afterwww.example.com/item/2

To resolve this issue open you code editor place blowacode in it and save file your project. File name must be .htaccess and and extension must be select ‘all type’. save it

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^item/([^/]+)/?$ item.php?product=$1 [L,QSA]

After saving the file your project can lose style files. if you face the problem follow this step. Open your project’s header.php and paste the below code in your head section.

<base href="http://example.com/index.php" target="_self" >

How To Boost Website Speed By .htaccess

Hey, guys if you want to speed your website speed so .htaccess file can be very helpful for you set some conditions to save website cookies in the browser. past below code in your .htaccess file.

RewriteEngine On
ExpiresActive On
ExpiresDefault "access plus 1 day"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"

How to work .htaccess speed booster

The code are display above it has some conditions to save cookies to the browser. when the web page load next time very fast. You can change its conditions and set time of cookies saving.

How To Create Clean URL By HTACCESS Get More Help.

Contact Us For Any Type Of Question at Blogging.

Social tagging: > >