Tag Archives: .htaccess

redirecting from /settings/ to settings.php using .htaccess

Questions: I want to redirect from localhost/myproject/setting/ to localhost/myproject/settings.php using the .htacess file. I used the following rule: RewriteRule ^setting/$ settings.php [L] But, it first takes me to localhost/myproject/setting/, then it runs settings.php file. I don’t want this. [There is no folder with name of “setting” in my root!] How I can fix my problem?… Read More »

Handle a directory like the www root with .htaccess

Questions: I have a problem with my deployment of my Laravel application on my sub directory. Locally my Laravel app is installed on localhost:8000; so there is no sub directory. On my live server, the Laravel app is located on example.tld/myapp. So whenevery I deploy my app on the live server, I have to change… Read More »

.htaccess url to post by slug

Questions: I have blog with posts. When i click on read more button i want to redirect and show selected post. Wanted url is http://www.solutions.com/blog/blog-post/slug. In .htaccess i have this: RewriteEngine on RewriteCond %{HTTP_HOST} ^solutions\.com RewriteRule ^(.*)$ http://www.solutions.com/$1 [R=permanent,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)$ $1.html [L] RewriteCond %{REQUEST_FILENAME} !-d… Read More »

Rewrite any subdomain to directory with .htaccess

Questions: Basically I want to make something like this: User enters in browser: https://user1.example.com/ (or any subdomain) It shows the content of: https://example.com/user1 I searched the whole internet for a solution for this, but none work, it is always showing “We can’t resolve the IP address of the server https://user1.example.com/” and I could only figure… Read More »

.htaccess url to post by slug

Questions: I have blog with posts. When i click on read more button i want to redirect and show selected post. Wanted url is http://www.solutions.com/blog/blog-post/slug. In .htaccess i have this: RewriteEngine on RewriteCond %{HTTP_HOST} ^solutions\.com RewriteRule ^(.*)$ http://www.solutions.com/$1 [R=permanent,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)$ $1.html [L] RewriteCond %{REQUEST_FILENAME} !-d… Read More »

Customize Url or Hide Query String using .htaccess

Questions: I am new one, I learn .htaccess. I want to customize my URL from index.php?page=mobile to index/page/mobile I used this code but it doesn’t work: RewriteEngine on RewriteRule ^index/([0-9]+)/?$ index.php?page=$1 [NC,L] # Handle product requests and RewriteEngine on RewriteRule ^index/([^/.]+)/?$ index.php?page=$1 [L] Answers:

.htaccess php Rewrite view.php?visopslag=(id)

Questions: I have to rewrite www.url.com/opslag/view.php?visopslag=(id) with htaccess to something more beautiful :o) Im creating a forum likely application. This is what i want to be rewrote: My request is: www.url.com/opslag/vis/id How can I do this? I’ve tried lots of different things like: RewriteRule ^/opslag/([^/\.]+)/?$ view.php?vis=$1 [L] My complete .htaccess: RewriteEngine On “#Rewrite view.php?vis=id RewriteRule… Read More »

mod_rewrite .htaccess causing 500 server error if URl does not exist

Questions: I’ve just started using mod_rewrite, this is what I use for a quite basic structured website with multiple language support: RewriteEngine on ErrorDocument 404 /error404.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z]{2})/([^/]+)$ $2.php?lang=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z]{2})/$ index.php?lang=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z]{2})$ index.php?lang=$1… Read More »