Hiiz is there a way that i can rewrite .htaccess from a php file? well actually i am using a cms for my site and whenever i make a new page i have to rewrite it in htaccess to make it work and SEO friendly. so i was wondering if there is a way to do it directly by php file instead of downloading .htaccess editing and re uploading it. please let me know if anyone have solution for that thx :)
wickedsunny
0
Junior Poster in Training
Recommended Answers
Jump to PostTry:
<?php $file=".htaccess"; $fp=fopen($file, "a"); $text ="\r\nRewriteEngine on \r\nRewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]"; fwrite($fp, $text); fclose($fp); ?>
Jump to PostBasically something like
RewriteEngine on RewriteRule ([^/\.]+)/?.html$ viewPage.php?ID=$1 [L]
So if you typed
www.blastingart.com/New Features.html
into the url, it would be the same as typing in
www.blastingart.com/viewPage.php?ID=New Features
Jump to Postdont get a rewrite rule for every page
get a PAGE rule for the php/mysql form
that generates a set of page names that match each other and the the rewrite tule
all the generated page names should match the existing rule
Jump to PostAll page names should generate from the database
for example/mysite/generatepage.php?id=somename
/mysite/somename.html
it is a waste of time and effort to not have all the page name generate automatically
the rewrite ruleRewriteEngine on
RewriteRule ([^/\.]+)/?.html$ viewPage.php?ID=$1 [L], and taken directly from the manual, does just …
All 15 Replies
buddylee17
216
Practically a Master Poster
wickedsunny
0
Junior Poster in Training
wickedsunny
0
Junior Poster in Training
buddylee17
216
Practically a Master Poster
wickedsunny
commented:
thanks simmply genius !!
+1
wickedsunny
0
Junior Poster in Training
almostbob
866
Retired: passive income ROCKS
wickedsunny
0
Junior Poster in Training
almostbob
866
Retired: passive income ROCKS
juustout
0
Newbie Poster
wickedsunny
0
Junior Poster in Training
buddylee17
216
Practically a Master Poster
almostbob
866
Retired: passive income ROCKS
wickedsunny
0
Junior Poster in Training
almostbob
866
Retired: passive income ROCKS
wickedsunny
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.