Mido™ 01-10-2011, 09:01 PM I want to ask if there is a way by using the .htaccess to convert the php extension in url to html without problems.
for example of the url is like this:
http://www.domain.com/videos.php?v=listvideo
it change to be like this:
http://www.domain.com/videos-v-listvideo.htm
poyzn 01-10-2011, 09:41 PM You need to use Apache's mod_rewrite
Add to your .htaccess file something like this
RewriteEngine On
RewriteCond %{REQUEST_URI} videos(.+)\.htm$
RewriteRule videos-v-(.+)\.htm /videos.php?v=$1 [L,QSA]
Mido™ 01-11-2011, 06:02 PM You need to use Apache's mod_rewrite
Add to your .htaccess file something like this
RewriteEngine On
RewriteCond %{REQUEST_URI} videos(.+)\.htm$
RewriteRule videos-v-(.+)\.htm /videos.php?v=$1 [L,QSA]
Thanks but seems your code is for this page "videos" only, I need to make it for all pages.
are you know a solution for this?
poyzn 01-12-2011, 06:46 AM Next code converts all .htm files into a query to index.php,
get filename or path wiht $_GET['q']
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)\.htm$
RewriteRule (.+)\.htm /index.php?q=$1 [L,QSA]
Mido™ 01-12-2011, 07:21 PM Next code converts all .htm files into a query to index.php,
get filename or path wiht $_GET['q']
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)\.htm$
RewriteRule (.+)\.htm /index.php?q=$1 [L,QSA]
it didn't make any thing!
poyzn 01-12-2011, 09:15 PM could you give me more details how do you what your script to work
ShaneC 01-13-2011, 01:29 AM Here's a script I wrote detailing how you can do mod_rewrite. It also contains a link to a very useful tutorial: http://www.codingforums.com/showpost.php?p=1032840&postcount=4
Moreover, this is a cheat sheet for explaining some of the symbols that you'll see in mod_rewrite: http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/
If you have a specific problem or can't figure out something in particular please post the details and I'll do my best to assist you.
Mido™ 01-14-2011, 12:40 PM could you give me more details how do you what your script to work
sorry I didn't understand what's you want to ask for.
Mido™ 01-14-2011, 12:44 PM Here's a script I wrote detailing how you can do mod_rewrite. It also contains a link to a very useful tutorial: http://www.codingforums.com/showpost.php?p=1032840&postcount=4
Moreover, this is a cheat sheet for explaining some of the symbols that you'll see in mod_rewrite: http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/
If you have a specific problem or can't figure out something in particular please post the details and I'll do my best to assist you.
Thanks but when I added it as you wrote in that post I got server error 500, and when I did it as that tutorial it didn't make any change!
Mido™ 01-16-2011, 05:11 PM hope if any one could help me.
poyzn 01-16-2011, 09:33 PM hope if any one could help me.
You should provide a rewrite rules or rewrite patterns to make a code.
I can't conjecture how you site's engine works.
Please describe fully what you want
Mido™ 01-17-2011, 06:12 PM You should provide a rewrite rules or rewrite patterns to make a code.
I can't conjecture how you site's engine works.
Please describe fully what you want
I want the url to be like this :
http://www.domain.com/videos-v-listvideo.htm
for all php page of the site that have variables values in url like this :
http://www.domain.com/videos.php?v=listvideo
poyzn 01-17-2011, 09:50 PM use this code
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/([^\-]+)\-([^\-]+)\-([^\.]+)\.htm$
RewriteRule ([^\-]+)\-([^\-]+)\-([^\.]+)\.htm$ /$1.php?$2=$3 [L,QSA]
this code gets htm filename and split it into 3 parts.
first - file name with the php script
second - your variable name
third - variable value
if you try to load /index-get-contact.htm this code convert will convert it into query /index.php?get=contact
Mido™ 01-18-2011, 04:38 PM use this code
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/([^\-]+)\-([^\-]+)\-([^\.]+)\.htm$
RewriteRule ([^\-]+)\-([^\-]+)\-([^\.]+)\.htm$ /$1.php?$2=$3 [L,QSA]
this code gets htm filename and split it into 3 parts.
first - file name with the php script
second - your variable name
third - variable value
if you try to load /index-get-contact.htm this code convert will convert it into query /index.php?get=contact
There is a misunderstanding here, I want to convert the php to html page, and this for the php pages with variables/values.
|