Fix link errors PHP, .HTACCESS

I made a website and I created .htaccess file and I am facing to a problem. After editing .htaccess file I renamed all the links according to .htaccess in the server that I am hosting the website. But in the localhost that is not working. Always shows the error 404. How should I fix this?… Read More Fix link errors PHP, .HTACCESS

htaccess http to https redirection apped twice www in url

Guys i have litle problem with migrating site from HTTP to HTTPS. I want to force all to www https http://example.com -> https://www.example.com (wrok) http://www.example.com -> https.www.example.com (not work) Above example return url with two http://www.www https.www.www.example.com My code RewriteCond %{HTTP_HOST} !="" RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] What i… Read More htaccess http to https redirection apped twice www in url

.htaccess redirect issue with multiple .htaccess file

I am using .htaccess file like below for redirect www to non www on my public_html directory RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] its working fine and redirect like below http://www.example.com to https://example.com Now in my sub directory called latest, I have another .htaccess file like below RewriteEngine on… Read More .htaccess redirect issue with multiple .htaccess file

PHP API main file

I have a question concerning an API that I am developing and I have just started asking myself the following question: As a rule, to reach the main file, you have to reach it in the following way api.domain.com/index.php/users/id/profile/… but many sites allow you to avoid calling the file index.php but put the "query" directly.… Read More PHP API main file

different htaccess for directory issue

root /question /pages index.html .htaccess /root/.htaccess RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/question /question/.htaccess RewriteEngine On #RewriteBase / RewriteRule ^question/are-bitcoin-gains-taxable/?$ /pages/questions/viewQuestion.php?id=9 [L] So what I’m trying to do is separate my htaccess into directories, this current setup is producing /404 error /pages/questions/viewQuestion.php? does exist, I just think its not reading the second .htaccess , Thanks… Read More different htaccess for directory issue

Redirecting query string for any search query for all URLs

I want to ask if it is possible to redirect example.com/something?query=hell to example.com/something/hell with the help of htaccess. I want to do it for all query i pass with GET method. Does anyone has any idea?? >Solution : You can do this with the following rule in your htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond… Read More Redirecting query string for any search query for all URLs

How to prevent user to access css files and images via the url

I am using .htaccess to prevent user to access files through url. The line RewriteRule ^frontend/assets/css/(.+) index [L,R] works fine. It prevents users to access css files. However, RewriteRule ^frontend/assets/images/(.+) index [L,R] //Images as well as RewriteRule ^frontend/assets/js/(.+) index [L,R] //Javascript files do not work. I have tried multiple solutions but still I can access… Read More How to prevent user to access css files and images via the url