3

I have read htacess condition from this url Htacess Url

but can't understand how to solve the problem when the condition is solve in htacess.

My main question is how to change the all php page into the html format any where to click the the PHP link then open the

Just Like Example : This php url any where to open that the redirect to the html page what i set the condition in htacess PHP Url

http://www.localhost/efundoo.com/products.php?product=Touch-Screen-Digitizer-For-Videocon-A10

And change into the

http://www.localhost/efundoo/public_html/products/lcd-display-for-samsung-galaxy-star-pro-gt-s7262.html

My htacess condition is following

1) This is running fine

RewriteRule ^([^/]+)/([^/]+)/?$ index.php?user=$1&type=$2  [NC,QSA]

2) but when i try this condition Page are not open

RewriteCond %{THE_REQUEST} \s/+.+?\.php\?user=([^\s&]+)&type=([^\s&]+)\s [NC]
RewriteRule . %1/%2.html? [R=301,L]
RewriteRule ^([^/]+)/([^./]+)/.html$ page.php?user=$1&type=$2 [NC,L,QSA]
2
  • 1
    What does Page not open mean? Are you getting a 404 error ? please explain more, your question is unclear so far. Commented Dec 23, 2015 at 10:18
  • @Starkeen How can i redirect the php pages into the html page using the htacess If the URLs are coming from anywhere the website and blogspot Commented Dec 23, 2015 at 10:27

1 Answer 1

1

Try this in .htaccess,

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

.htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>

.html to .php

RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L]

.php to .html

RewriteCond %{THE_REQUEST} \ /(.+)\.php
RewriteRule ^ /%1.html [L,R=301]

config.php file:

$config['index_page'] = ''; //specify your html file
Sign up to request clarification or add additional context in comments.

2 Comments

Yes project is in CI. I am some php url post into the blog and now my site is fully html based. how to changed these php URLs into the html page using the htacess
I See this but can't solution Html & PHP Page both are open I want one page open in site only html if user click the php file then open the HTML page another wise html are automatically open products.php?product=Full-Body-Panel-Nokia-1208-Mobile-Phone-Housing-Fascia-Faceplate

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.