The following .htaccess Rewrite below seems working fine if the URL is something like: example.com/news/post-1 However, if the URLs have more parameters, something like: example.com/news/post-1/comment-page-1 (URLs from another version of the website) I will get a 500 Internal Server Error. How I can make it …
Tag: mod-rewrite
Why Apache RewriteRule treats the same way with ‘&’ and ‘?’
I’m trying to code a custom rewrite rule for ‘.htaccess’ file in my Apache webserver. The main idea is to handle requests in the form: to ‘index.php’ file in the www_root: As everyone knows, this is easy to do. Just by adding below lines to ‘.htaccess’ file: But the p…
PHP When rewrite pages url then the $_get not working
I am using this URL rewriting with PHP The Folder structure for rewriting the URLs. I am done it is working fine but after rewrite the URL the $_GET[‘cat_id’] is not working. How to get the data now? …
Customize URL rewriting with htaccess
I have the following in my htaccess: It works perfectly, the question is whether it would also be possible to automatically redirect it to the new path when the PHP file is accessed directly? For example: example.com/pwreset.php >> example.com/reset-password There are several pages, so I needed somethin…
Apache RewriteMap prg using fopen(‘php://stdin’, ‘r’) not working over HTTPS
I’ve set up a RewriteMap using prg which calls a php script, like this: And then .htaccess puts the output in an env variable MAPTO like this: It works correctly over HTTP, but over HTTPS no input is returned. I’m using Apache 2.4, PHP 7.2 and have confirmed that OpenSSL is installed. What could b…
redirect 301 to / if url contains index.php
I have a blog in laravel 5.8 and I want to redirect 301 to / it there is index.php in the url. My .htaccess is this …
How to rewrite URLs with .htaccess (removing id?=1)
I’ve looked all over and have yet to figure out how to make this work, I’m sure it’s very simple for someone who knows what they’re doing. For starters, I have made sure that mod_rewrite is enabled …
Are external links from other sites also redirected?
I have a pretty straight forward question about 301 redirect. So I’ve written 301 redirect for one folder on my site to another site: RewriteRule ^example/folder https://example-new-site.com/ [L,R=…
why does .htaccess rewrite behave differently based on form content?
I am doing a post transaction with “having x,” in the form field being submitted. My .htaccess is ensuring https: and www. My redirect is changing the post to a get for the previously mentioned data. …
.htaccess – How to redirect URL to a folder and then to a PHP file
I am setting up a cache system for my blog (not a WordPress) and I want to store the cached files in a posts/ folder, so I don’t fill my root folder with post files. I have a file called post.php that creates these posts files if the slug corresponds to an actual post in a different website (I check