Questions tagged [mod-rewrite]

The mod_rewrite module uses a rule-based rewriting engine, based on a PCRE regular-expression parser, to rewrite requested URLs on the fly.

The mod_rewrite module uses a rule-based rewriting engine, based on a PCRE regular-expression parser, to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.

mod_rewrite provides a flexible and powerful way to manipulate URLs using an unlimited number of rules. Each rule can have an unlimited number of attached rule conditions, to allow you to rewrite URL based on server variables, environment variables, HTTP headers, or time stamps.

mod_rewrite operates on the full URL path, including the path-info section. A rewrite rule can be invoked in httpd.conf or in .htaccess. The path generated by a rewrite rule can include a query string, or can lead to internal sub-processing, external request redirection, or internal proxy throughput.1

1Source:Apache

47 questions
32
votes
3 answers

Enabling .htaccess file to rewrite path (not working)

All the tutorials tell me to edit the: /etc/apache2/sites-available/default but this file doesn't exist for me. Within this file I would have to edit the: Options Indexes FollowSymLinks MultiViews AllowOverride…
inControl
  • 423
24
votes
5 answers

mod_rewrite is enabled, but not working

I'm trying to get a PHP routing library set up. They give this example for a .htaccess file: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php [L] I couldn't get this to work, so I…
7
votes
3 answers

mod_rewrite use in Apache 2.4

Okay, so there are plenty of threads on how to use mod_rewrite, but I find it seems to work a bit differently in Apache 2.4. I tried this: RewriteEngine On RewriteBase…
Tjita1
  • 493
6
votes
2 answers

Why do I get 404 on LAMP Permalinks (Using wordpress)

I have been working on a website on an ubuntu server (amazone) and I get 404s entering pages. I'll give all the information I can regarding the problem. On WordPress Refresh page: I followed this tutorial:…
Kar19
  • 459
  • 1
  • 7
  • 28
5
votes
1 answer

How to enable clean url with Ubuntu 16.04, Drupal 8.1.10 and Apache 2

I'm trying to install Drupal 8.1.10 on a virtual private server (OVH) with Ubuntu 16.04, Apache 2 and PHP7. I followed this tutorial : https://www.howtoforge.com/tutorial/how-to-install-drupal_8-with-apache-and-ssl-on-ubuntu-15-10/ I'm stucked at…
JPO
  • 51
  • 1
  • 4
4
votes
5 answers

how to config htaccess file after enabling mod_rewrite module?

I already install apache2 then i enable the mod_rewrite module like this: sudo a2enmod rewrite after enabling i am confused about these lines, i can't understand what to do with them, as far as i know that what i have to do with these lines is that…
3
votes
1 answer

The requested URL not found - in Digital Ocean LAMP Webmin server

I'm new to Digital Ocean & Ubuntu, in the midst of migrating from Exabyte shared server's Codeigniter (v3) website to Digital Ocean server Server details/installation : Digital Ocean Droplet - Ubuntu LAMP on 16.04 Apache - Apache/2.4.18 ( Ubuntu…
Mavichow
  • 151
3
votes
2 answers

.htaccess file not running and internal server error

I am using ubuntu 14.04 and have LAMP environment. I have one of the project in dir /var/www/html/project1 . It can't access the .htaccess file for rewriting url rules. For that i have to change in /etc/apache2/apache2.conf file
3
votes
2 answers

HTTP to HTTPS rewrite rule not working

ubuntu 14.04 Apache/2.4.7 I am posting here conf file for my virtual host and default ssl host. not able to figure what am I doing wrong. http:// shows the index of the folder. I want to redirect this to…
Rajeev
  • 173
3
votes
2 answers

How to set Apache virtual host correctly for Drupal 8

I installed the Drupal website in this path: /var/www/html/testdrupal.localhost/public_html/drupal/web Below I show the virtual host configuration file testdrupal.localhost: Require all…
2
votes
2 answers

Apache mod_rewrite rules don't work with dynamic virtual host and php-fpm

I've created a dynamic virtual host using this configuration file: UseCanonicalName Off ServerName %1.dev ServerAlias *.%1.dev ServerAdmin daniel@localhost VirtualDocumentRoot /home/daniel/public_html/%1 …
2
votes
1 answer

How to add and enable rewrite module in manually installed apache httpd web server?

I installed apache httpd server by compiling source on Kubuntu 14.10. I ran wget http://www.us.apache.org/dist//httpd/httpd-2.2.29.tar.gz tar -xzf httpd-2.2.29.tar.gz cd httpd-2.2.29 ./configure --enable-shared=max make sudo make install I…
Alok
  • 504
2
votes
1 answer

Apache web server - how to strip language extentions

This question pertains to publishing the Ubuntu Serverguide on help.ubuntu.com. For the 20.04 LTS cycle, there will (O.K. might) be significant changes to the source code workflow for the Ubuntu Serverguide. Currently, translations are not being…
1
vote
1 answer

Problem with apache 2.4.6 on ubuntu 13.10 no rewrite for wordpress links

My rewrite was working well until i updated my apache and than went dead . My 000-default.conf # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used…
1
vote
1 answer

Is the rewrite module activated for nginx in the Wordpress juju

Is the rewrite module activated for nginx in the Wordpress juju? When I change the permalink to anything other than default I get bad gateway. rewrite is mandatory for buddypress to function properly. Can anyone help me solve this issue?
1
2 3 4