Posts

Showing posts with the label .htaccess

.htaccess redirect FROM subfolder to domain name

.htaccess redirect FROM subfolder to domain name I had website content in a subfolder (http://mydomain.com/subfolder/index.php), now I copied everything over to the root folder (http://mydomain.com/index.php). I would like to redirect all the visitors that have bookmarked the old page to the new content (at least to the new index.php) using .htaccess. Is this correct: RewriteEngine on RewriteRule /subfolder/^(.*)$ http://mydomain.com [R=301,L] ? And where would I place the .htaccess file, in the subfolder or the root folder? 3 Answers 3 Placing the following .htaccess in / (where your index.php is located) should do the trick: .htaccess / RewriteEngine on RewriteRule ^subfolder/(.*)$ /$1 [R=301,L] Or you could place the following .htaccess in /subfolder : .htaccess /subfolder RewriteEngine On RewriteRule ^(.*)$ /$1 [R=301,L] Note that the () around .* and the $1 redirects /subfolder/someFile.p...

Htacces and Paginator

Htacces and Paginator Sorry for my English. I do not speak the language well. So I use the htaccess file. RewriteRule ^(w+)/?$ index.php?id=$1&name= [L,QSA] RewriteRule ^(w+)/(w+)/?$ index.php?id=$1&name=$2 [L,QSA] RewriteRule ^(w+)/?$ index.php?id=$1&page= [L,QSA] RewriteRule ^(w+)/(w+)/?$ index.php?id=$1&page=$2 [L,QSA] And paginator: <?php $count = DB::queryFirstField("SELECT COUNT(*) FROM articles"); $total_records = $count; $total_pages = ceil($total_records / $limit); $pagLink = "<div class='listar-pagination'>"; for ($i=1; $i<=$total_pages; $i++) { $pagLink .= "<li><a href='all_corp/page/".$i."'>".$i."</a></li>"; }; echo $pagLink . "</div>"; ?> The paginator not working. If i open the https://gotogo.hu/all_corp/page/2, the page not loading. What might be the problem? ...