Skip to content

Tag: .htaccess

PHP / htaccess: block indexation when GET parameter is present

I would like to prevent search engines from indexing with some specific get parameters. Example: should be indexed should not be indexed I have many pages (more than 10k) with get parameters that are indexed on top of the main page despite sending a no index in the header. I have this in robots.txt: And this in the

Default CodeIgniter controller not working or is it my htaccess?

I’m using CodeIgniter 3.1.13 and configured my htaccess file to remove “index.php” but when I try to go to a webpage it doesn’t work unless I put the default controller in the URL. Any advice? Going to the following URLs work fine… But the following URL does not work… How do I get this URL

.htaccess – Permanently redirect to root when the website is accessed with with no query string parameters?

I am using a template on my website. This template is designed in a way where everything is in the index.php file but the functions are executed based on the query string which is stick to the index.php file. I want to permanently redirect to the root when my site is accessed with index.php with no query string parameters,

how to get url last part after slash as get value in php

My url is look like: http://localhost/event_manage?slug=hello and last value as like hello So that page is in index.php when i go http://localhost/event_manage/hello and shows error because there is no folder as named hello. But i want this hello is like GET value When I go http://localhost/event_manage/hello I tried in .htaccess file: But it still shows error and couldn’t pass the

can not hide X-Powered-By with expose_php

I want to hide my php version in response headers and for that I changed expose_php to off but it does not work and I added Header unset X-Powered-By to my htaccess file but in did not work either can you guide me for that? Answer and I added Header unset X-Powered-By to my htaccess file but in did not

How to redirect all requests to a PHP file inside a subdirectory in apache2?

My document root is /var/www/html/. I created a directory called myapi inside like /var/www/html/myapi. The folder structure in /var/www/html/myapi is like I want all the requests such as http:localhost/myapi/books would be redirected to the index.php inside the src folder. my current .htaccess setup: RewriteEngine is already switched on. But it doesn’t work and the server does not respond. May I

Serve file from cache folder if it exists, otherwise rewrite to “index.php” using .htaccess

Suppose in root directory I have one file (called index.php) and one folder (called caches). I want that if the file exist in caches folder serve that file (caches/xxx.html) otherwise request send to index.php. For example I will send request to server: and Apache search first in cache/. If how-to-do.html exists then send (rewrite Apache) how-to-do.html otherwise send request