Questions tagged [.htaccess]

Apache web servers utilize a distinct configuration file at the directory level. Only employ this label in instances where the .htaccess content is directly related to the subject matter. Although many individuals may rely on .htaccess, we kindly request that community members refrain from tagging unless it pertains specifically to your question. Furthermore, pay attention to the guidance provided by the [tag:apache] tag regarding inquiries about configuring Apache httpd and their potential off-topic nature on Newtab Q&A.

Using .htaccess to Handle Empty $_POST Requests

After searching extensively on the internet, I am still unable to find a solution to my problem. I have an .htaccess file that successfully rewrites my query string into the GET variable. However, I have encountered a new issue when dealing with the POST ...

.htaccess 404 not redirecting properly

I need help with the following code snippet: # Keep this line intact for mod_rewrite rules to function properly RewriteBase / ErrorDocument 404 /errors/404.php Despite having the file 404.php in the errors folder, it doesn't seem to be working as expec ...

Issue occurred while proxying to the blog subdomain from a Node.js application

I currently have a NodeJS application running on Heroku, accessible at www.example.com. Additionally, I have a WordPress blog set up on a subdomain - blog.example.com. To handle routing, I've configured a route in Express: (utilizing express-http-pr ...

What is the best way to prevent caching of pages that are using a local JSON file in Next.js static generation?

After deploying my Next.js app as static on my cPanel traditional hosting, I encountered an issue. Some pages are consuming a local JSON file that I fetch using getStaticProps, with the "revalidate" option set. However, when I make edits to the JSON file ...

Create an .htaccess RewriteRule that can generate a URL with two parameters in any order

I am facing an issue with the URL structure containing 2 parameters https://mywebsite.com/folder/subfolder/page.php?id=999&title=this-is-a-test I require a rule to transform the above URL into the following format: https://mywebsite.com/page/this-is ...

Configuring an exception for api.php in the .htaccess file

Since transitioning my server front end and back-end to use the Symfony framework, I have encountered an issue with accessing my API file over HTTP. Even with exceptions written in my .htaccess file, I am unable to retrieve data from my NodeMCU (such as te ...

My server is experiencing issues with the functionality of the .htaccess file

My website can be accessed at https://itjmovies.com/milan/public/. I am trying to rewrite the URL using an .htaccess file. Specifically, I want to change it from https://itjmovies.com/milan/public/ to https://itjmovies.com/milan/, but my attempts have not ...

Still having trouble getting @font-face to work with Firefox and htaccess

I've been struggling to load my custom font in Firefox despite numerous attempts. Here is the @font-face property code I have placed in the head section: @font-face { font-family: 'MeanTimeMedium'; src: url('http://sweetbacklove.com/fonts/meantimec3-we ...

RegEx pattern for setting DirectoryIndex in htaccess

Apologies if this topic has been discussed before regarding .htaccess, but I have yet to find a clear answer to my specific questions. Here are the issues I am facing: 1. My goal is to eliminate index.php from URLs both in the home directory and subdirecto ...

Managing subfolder controllers in CodeIgniter using routes

When working with two controllers in subfolders, I want to display only the function name in the URL instead of the controller names. $route['admin/test'] = "admin/sample/test"; $route['admin/test1'] = "admin/index/test1"; Admin represents a subfolder ...

Symfony .htaccess - troubleshooting 500 error on third level domain

My application is located in a subdirectory at www.example.com/application/v1 and I have a third-level domain set up at v1.example.com. I am using Symfony2 and this is the content of my .htaccess: DirectoryIndex app.php <IfModule mod_negotiation.c> ...

Leveraging mod_rewrite in conjunction with CodeIgniter on Nearly Free Speech hosting platform

I must confess that I am quite inexperienced when it comes to .htaccess and server-related matters in general. Recently, I developed a website locally using Wamp and implemented a .htaccess file which I stumbled upon through online research. <IfModule ...

What is the best way to create an htaccess file for showing user-friendly URLs?

I have recently created a website and I am trying to set up a user-friendly URL structure. Currently, the URL for my website looks like this: http://example.com/1/post To achieve this, I am passing query strings in the following way: <a href="page.ph ...

How can I modify the # symbol with .htaccess?

When someone accesses the following URL: www.facebook.com/index.php#sk=inbox The .htaccess file will redirect it to the server as: www.facebook.com/index.php?sk=inbox This allows me to retrieve the value of sk using PHP like this: *echo $_GET['i ...

Investigating the presence of a file within the superior directory with RewriteCond

I am attempting to enhance this .htaccess file in order to redirect all requests to a script when the requested file or directory is non-existent. However, I want to refactor it so that it checks for the existence of the file in the parent folder. Curren ...

The attempt to access a URL was unsuccessful due to a failure to open the stream, along

All my requests are modified to point to index.php. Have a look at my .htaccess file provided below. IndexIgnore * <IfModule mod_rewrite.c> #Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond % ...

Zend Framework redirect problem: Controller specified is invalid

I'm currently working on a project using Zend Framework 1.12. When all the files are kept in the root folder, everything functions correctly. However, if I create a new folder and move all the files into it, nothing works as expected. This is my cur ...

Steps for transforming domain.com/#!/url into domain.com/url are outlined below. Firstly

Can someone help me figure out how to change the link structure from domain.com/#!/home to domain.com/home? I tried using htaccess but had no success. After researching online, I learned it is referred to as "ajax crawling" but I couldn't find a solut ...

Issues arising from URL encoded characters that fail to get rewritten

I have set up rules for dynamic redirects to point old URLs to new locations. However, I encountered an issue where the redirect failed when URL Encoded Characters were present in the URLs. Here is an example of such URLs: www.example.com/ebc-drama-yebet- ...

Unable to modify the URL structure for an MVC project

I have been trying to find a solution by googling, but I am stuck here. Options +FollowSymLinks RewriteEngine On RewriteRule ^index.php|style.css|img.png$ - [L] # RewriteRule .* index.php [L] RewriteRule ^(.*)$ index.php?params=$1 [NC] When I v ...

PHP in conjunction with .htaccess does not support the use of $_GET variables

I currently have a .htaccess file located in the root of my webserver, containing the following code: Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^.*$ ./index.php Everything ...

What is the best way to convert a URL into a PHP array using mod_rewrite?

I am struggling with how to rewrite a URL (using mod_rewrite) from this format: https://example.com/foo/bar/123/asd/qwerty to this format: https://example.com/index.php?controller=foo&action=bar&params[]=123&params[]=asd&params[]=qwerty ...

Modify a specific URL within the .htaccess file without relying on a specific pattern

I am looking to transform one specific URL on my Joomla website into a more user-friendly format. The current URL is: www.example.com/index.php?option=com_mycomponent&view=article&id=10&nav_button=0&article_layout=1&Itemid=503 and I w ...

Enhancing Website Functionality with Htaccess and PHP Routing Techniques

In order to achieve the desired URL of "https://example.com/VdnbzeHfua/ep1_mp4", it is important to note that my page, located in the root folder, is titled "index.php". When accessing the aforementioned URL, there should be no redirection to any subfolde ...

Issues with ReactJS routing, encountering errors in the 500 range, as well as difficulties with the functionality of .htaccess rewrite rules specifically on

I developed a React application using the create-react-app template. In my package.json file, I set the homepage value to '.' like this: { ... "homepage": ".", ... } However, after deployment, I encountered 500 server erro ...

obtain the subdomain as a query parameter

Hello everyone! I am currently in the process of configuring my web application to provide users with unique URLs like uniquename.mysite.com and anotheruniqname.mysite.com. I would like to be able to extract the subdomain section of the URL using a PHP sc ...

How can the condition for rewriting the request file name be written as something other than the specified

I am currently dealing with an issue regarding htaccess. I need to create a condition that will prevent a specific file from being served. If the requested file exists, it should be served. Here is what I have so far: RewriteCond %{REQUEST_FILENAME} -f R ...

Using symbolic links prior to the controller/method in CodeIgniter

Feeling a bit stuck and in need of help, I've decided it's time to reach out for some assistance. Here's my situation - I've been attempting to use a symbolic link to mask my URL like this: www.website.com/uk/controllers/method/etc www ...

How can I enable browser caching for test.json, which is generated by json.php using Apache's rewrite feature?

How can I configure browser caching for test.json, which is generated by json.php? Unfortunately, the response headers for test.json are set as if it were a .php file and not a .json file. How do I correctly apply .htaccess rules so that the generated tes ...

Changes made to the .htaccess file are preventing the $_GET variable from being set

For a while now, I've been utilizing '.htaccess' to modify the appearance of page URLs. Instead of: details.php?video=how+to+do+this&user=xxx I prefer it to look more like this: /details/xxx/how+to+do+this Although it's function ...

The problem lies in the incorrect rewriting of static resources leading them to be redirected to the

I am currently facing an issue with rewriting URLs. It seems that the problem lies in the redirection of certain URLs to index.php?route=scores, etc. http://www.example.com/scores http://www.example.com/registreren http://www.example.com/login This redir ...

Using htaccess to restrict access to a specific URL path based on IP Address

(I don't believe the previous link addresses this question; please refer to the comment below) I am currently utilizing a CMS platform that utilizes a database instead of the usual file-directory structure for managing webpages. Due to the absence of indi ...

"Encountering a 404 Error when attempting to refresh an Angular 13 application hosted on an Apache

I have developed a prototype web application and now need to deploy it on an Apache server running Ubuntu OS. After building the web app, I hosted it on my local machine for testing purposes. I have configured the .htaccess file as follows: RewriteEngine ...

Could Absolute Paths be the ultimate fix for problems with htaccess URL Rewrite?

Trying to accomplish a simple task of changing URLs from website.com/user?slug=usernameexample to website.com/user/usernameexample? I implemented the following code: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/?us ...

Correcting the reference to "/" (root) for assets after relocating the site to a subdirectory

I currently have a website located in the public_html directory, where all assets (images, css, js, etc) are referenced using /asset_folder/asset. The "/" at the beginning ensures that the browser starts from the root and navigates through the directories. ...

You can only access mypage.php from the /mypage directory, not from /mypage.php

Currently, I am in the process of developing a PHP website and utilizing htaccess to conceal php extensions using the following script: Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILEN ...

"Exploring the world of AngularJS routing and using htaccess for rewriting URLs

How can I seamlessly integrate AngularJS ngRoute and htaccess rewrite? Currently, my ngRoute setup generates URLs like this: http://domain.com/#/something/somestring However, I would prefer cleaner URLs like: http://domain.com/something/somestring In ...

The occurrence of a mod rewrite mishap necessitates the inclusion of a

I have attempted to create a .htaccess Mod Rewrite "script" (if you would call it that). However, I am experiencing interference between two lines. The rules are as follows: RewriteRule ^(.*).tcl index.php?SetTravelCode=$1 And : RewriteRule ^status_(.* ...

"Encountering a 404 error while trying to refresh

I've already attempted to include <base href="/index.html"> and/or <base href="/"> My .htaccess configuration is as follows: Options +FollowSymLinks <ifModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f ...

Enabling social media crawlers to function properly (such as Facebook and Twitter) in an Angular 11 Single Page Application (SPA

I've developed a Single Page Application (SPA) using Angular 11 and it's being hosted on a shared hosting server. The problem I'm facing is that I can't share any pages, except for the homepage (/), on social media platforms like Facebook and Twitter beca ...

Learn how to incorporate PHP7 code into your HTML file through the use of .htaccess configurations

I have a Linux server with PHP 7.* installed. I want to embed PHP code into HTML files, but currently it just renders the PHP code on the webpage. I've tried adding the following code to my .htaccess file, but it doesn't seem to be working: AddHandler x-h ...

Rewrite the nginx configuration to eliminate the "/index.html" part of the URL while preserving the query

My Nginx configuration specifies index index.html as the default index page. When accessing it as a progressive web app (using Angular), the URL loads as /index.html#/route instead of /#/route for some reason. I want to: Check if the URL contains ...

Using HTML URL parameter in PHP code

Hi there, I'm new to using PHP and would appreciate any help you can provide. I'm facing an issue with passing a URL parameter from an HTML page (mywebsite.com/f.html?survey_id=5d86055f35bf41f3a35f2c779fc478dc) to a PHP script that should save t ...

Occasionally experiencing intermittent 404 status code from admin-ajax.php

I recently launched a new website using Wordpress on a shared hosting platform, but I'm encountering some issues with the theme customization panel. Every time I try to save changes, a window pops up with an error message saying, "Looks like something ...

Updating AngularJS: Removing the hashtag using history.pushState()

Struggling to enhance the aesthetics of the URLs in my AngularJS application, I am facing some challenges. While I can access the "/" route without any issues, the "/about" route seems to be out of reach. Please note that the project is situated at (loc ...

Direct users according to their browser language (excluding php)

My site is going to have content in 3 languages, with French set as the default (fr). Here's how the structure of the website looks: Root directory (important note: no php files, just plain html) /fr/ Index.html About-us.html Contact.html /e ...

What is the best way to create a link in PHP when a backslash is included in the

I recently received help on adding a forward slash to my URL and redirecting it internally. The solution I found worked well, you can check it out here, but now I've encountered a new issue. After resetting your password, you're required to change it: if ...

.htaccess rewrite rule not functioning properly in the absence of a trailing slash in

I have the following URLs: www.website.com/index.php?section=index www.website.com/index.php?section=freebies www.website.com/index.php?section=deals www.website.com/index.php?section=articles and the pagination URL parameter for each page is set as "pag ...

Using mod_rewrite to conceal the .php extension is currently not functioning as intended

Is there a way to hide .php extensions from my URLs like this: www.example.com/index.php To appear as: www.example.com/index I have the following content in my .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_F ...

Is it possible to prevent PHP users from accessing files through a URL?

Is there a method to prevent users from directly accessing a specific file in a designated directory via URL, while still allowing a PHP script to manage and retrieve the file? In simpler terms, I aim to hinder individuals from inputting: . Perhaps redire ...

Revamp every single hyperlink that ends in .html

I am looking to customize the URLs on my website to appear like this: www.example.html/1 www.example.html/2 www.example.html/3 instead of their current format: www.example.html/1.html www.example.html/2.html www.example.html/3.html Can anyone provide a ...

Refreshing product names in URLs

I am looking to rewrite a rule for my products. My goal is to utilize the id and name in the URL, separated by a dash like this: 123-name translates to product id = 123 and name = name This way, in my PHP code, I can fetch the $_GET[id] and then query ...

URL rewriting does not retrieve information from the $_GET superglobal

I have defined certain rules for URL rewriting on my website. Currently, I am working on localhost I have configured this in the .htaccess file php_flag output_buffering on Options +FollowSymlinks RewriteEngine On RewriteRule ^p/([^/]*)\.html$ /?p= ...

CodeIgniter encountering a persistent issue with AJAX that causes it to reload the

Whenever I attempt to send an AJAX request with jQuery, the response I receive is the HTML of the same page! Here's a live preview (editing not available as I am currently fixing it) Below are the files: Main controller: Class Main extends Controller { ...

Trouble encountered when trying to access files in the media folder

I am encountering a peculiar issue where I am unable to access any files from the media folder, but I can access files from the js folder, both of which are located in the same directory: app/public/media app/public/js The permission for the Media folde ...

Successfully launched Laravel application, experiencing issues with all pages except for the homepage

I recently completed a website for a client and everything seems to be working fine locally. Unfortunately, when trying to access any links on the site, I am getting a 500 server error. The hosting is with 1and1, and I've heard mixed reviews about it. The ...

Can Angular routing be used with a LAMP server?

I have decided to host my Angular 2 application on which offers a traditional LAMP stack for hosting. In my local ng serve environment, the route www.mysite.com/myapp/item/:id functions perfectly. However, when trying to access www.mysite.com/my-app/ite ...

Customization of .htaccess to Control URL Using Conditions

RewriteRule ^pictures/?$ pictures.php [L] RewriteRule ^pictures/(.*)/?$ pictures.php?album=$1 [L,QSA] RewriteRule ^pictures/(.*)/(.*)/?$ pictures.php?album=$1&page=$2 [L,QSA] I am in need of having several options like: /pictures /pictures/album /p ...

Is there a way to eliminate a variable name from a URL using htaccess?

Essentially, I am looking to allow users to access my website using a URL like /45678, as opposed to the traditional /?p=45678. The goal is to eliminate the variable name from the URL. I attempted to achieve this by utilizing mod_rewrite, but it appears th ...

Greetings! I am looking for information on how to activate CORS in a Ruby on Rails API application deployed on OpenShift for use with an Angular

My current setup involves a script utilizing Angular to display records fetched from a Rails API REST, which is hosted in OpenShift. In my public/.htaccess file, I have included the following directives: Header add Access-Control-Allow-Origin "*" Header a ...

Please update my htaccess file with a new rule that replaces "?" with "/"

Can you review my htaccess file below? ErrorDocument 404 /error404.php ErrorDocument 403 /error404.php Options -Indexes RewriteEngine On RewriteBase / RewriteCond %{REQUEST_METHOD} POST [NC] RewriteRule ^ - [L] RewriteCond %{HTTP_REFER ...

Unable to successfully redirect index.php to the root domain from the specified URL

Greetings to the stackoverflow community users, I am facing a little trouble with a URL redirection issue. Currently, my webpage URLs include index.php (), and I am attempting to redirect it to the root domain using an htaccess file. I have added the co ...

Issues with Codeigniter's uri_protocol and .htaccess configuration have been causing problems as the uri_protocol settings are not functioning as

Here is the content of my .htaccess file: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] And this is my config file settings: $config['base_url']= ''; $config[' ...

Looking for a solution to replace a section of a filename in a URI using htaccess mod_rewrite? Cross-domain

I've been going through tutorials on htaccess, but every example I find seems to use an absolute URL in the rewrite. Since my site spans multiple domains, I need a solution that works across all of them. The rule I'm looking for is: Any link that original ...

Please view the file by accessing exclusively mydomain_name/filename.html

I am looking for a way to block access to specific URLs on my domain and redirect them to another page. The user should still see the original URL in the address bar, and all styles and scripts need to function properly. Can someone help me achieve this? ...

Secure a certain domain using password protection in the htaccess file

I am managing 3 domains: example.com sub1.example.com sub2.example.com All three are directed to the same server and folder. My goal is to secure sub1.example.com and sub2.example.com by requiring a password to access the root folder, while allowing unre ...

Eliminating .php from the URL and the GET request

After implementing .htaccess, I successfully transformed the URL: http://www.websitename.co.uk/directory/users.php?id=idValue&data2=data2Value Into http://www.websitename.co.uk/directory/users?id=idValue&data2=data2Value HTAccess: RewriteE ...

I am experiencing difficulties with URL rewriting in apache2 and cannot get it

I've been attempting to rewrite the URL for my PHP application, but it just isn't working as expected. Here is a look at my directory structure: /var/www/html/test| |---.htaccess |---index.php Within my .hta ...

Sending PUT and DELETE requests in a Laravel application hosted on a shared server

I have developed a unique Laravel CMS application that is functioning perfectly on my local environment. Now, I am attempting to deploy it on a shared hosting server. To achieve this, I have organized all Laravel app files and folders (excluding public) i ...

Zero value is requested using the GETS method

Hey there! I'm currently working on extracting the request method when a URL is requested from my localhost. To achieve this, I've implemented URL rewriting so that http://localhost/API2/products.php?product_id=1 is transformed into http://localh ...

Prevent any requests in .htaccess that have a starting uri with a period or underscore using Regex

Currently, I am utilizing the .htaccess file to prevent potentially harmful requests from reaching my project. My existing RewriteCond blocks requests based on User Agent, but now I want to also block requests with paths starting with . or _. For instance ...

tips for modifying the URL to display the username directly from the URL

I am attempting to set up my profile page URL structure similar to Facebook's. For example, I want the URL to be example.com/johndoe which would display John Doe's profile page. Despite my efforts, I have not been able to accomplish this task successfully. ...

Redirecting htaccess based on folders and file extensions with capitalization variations

Transitioning content from an old Windows site to a new CMS setup presents some challenges, particularly when it comes to preserving certain pdfs/images that are linked from external sources. To maintain these links without redirection, some folders and fi ...

What steps do I need to take to enable basic authentication for my PHP app on Heroku?

I need help enabling basic authentication for my simple PHP application hosted on Heroku's Cedar Stack. I am unsure if .htaccess / .htpasswd is supported in this environment. Can someone guide me on how to activate basic auth? ...

prohibit linking directly to AJAX pages within a specific folder

Is there a way to prevent direct access to pages in the AJAX directory while still allowing them to be served from their parent page? I've tried various .htaccess configurations, but they end up blocking access from the main page as well. Essentially, ...