Tag Archives: .htaccess

I am trying to change my url with .htaccess, but getting some problems

Questions: This is my URL after clicking the menu http://mywebsite.com/page/english-lession/learn-about-influential-people After that on the same page i have another menu for sorting. when i click on it, it is adding like &mode=advanced in url. I have added mode variable in the last http://mywebsite.com/page/english-lession/learn-about-influential-people&mode=advanced This is my code: Options -Indexes <IfModule mod_rewrite.c> Options +MultiViews Options +FollowSymLinks… Read More »

Writing to .htaccess with php

Questions: I am trying to add lines to my .htaccess file using a simple php script. I know this is dangerous – it’s for development, testing and learning, not for production. I want to add lines of page redirects like this to .htaccess: Redirect /url1.html https://exampleredirecturl.com/page1 Redirect /url2.html https://exampleredirecturl.com/page2 The script I’m using is this:… Read More »

.htaccess RewriteRule pointing to div id on page

Questions: I have a basic web page with a few divs on it with the ids one to ten. When I visit a URL like this: www.example.com/page.php#six the page will load and I will be looking at div id six. I’d like a RewirteRule which allows a url like this: www.example.com/page/six and the page will… Read More »

Apache / .htaccess : website optimizations

Questions: I make my website from scratch with PHP. In order to optimize performance, loading time and security I use a lot of online tools : google page speed insight, gtmetrix, dareboost.com, webpagetest etc… Dareboost.com advises me to set headers in my .htaccess file like : Content-Security-Policy X-FRAME-OPTIONS X-XSS-Protection X-Content-Type-Options I did : Header set… Read More »

How to write a simple .htaccess with two entry points

Questions: I have problem while trying to use below .htaccess file to direct my requests. every one begin with rest to rest.php and others to index.php. the problem is all request directed to index.php even the ones begin with rest. did i miss something ? RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^rest(.+)$… Read More »