In Drupal 7, there was a 'clean_url' configuration variable, and a admin/config/search/clean-urls form for configuring it. This has been removed from Drupal 8. Instead, if you access a Drupal page whose path is 'some/path' as http://example.com/some/path, then Drupal detects this as a clean URL and outputs all links from that page as clean URLs. On the other hand, if your site is on a server where clean URLs do not work, you can access that page as http://example.com/index.php/some/path, and when you do, Drupal outputs all links from that page as "dirty" URLs (i.e., with the "index.php" included).
If you have publicly exposed URLs that include old-style dirty URLs, using ?q=, it is recommended to adjust your URLs to the new format ASAP. To provide automatic forwarding for ?q=-style URLs to avoid SEO breaks, install the Legacy Redirect module.
There is some in-progress work for handling upgrade issues and edge cases in #1546082: Follow-up to variable_get('clean_url') removal.
As a result of this change, modules that display label prefixes in front of form input elements containing Drupal paths can be simplified as follows.
Drupal 7:
function path_admin_form($form, &$form_state, ...) {
$form['source'] = array(
'#type' => 'textfield',
'#title' => t('Existing system path'),
'#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1.'),
'#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
);
...
}
Drupal 8:
function path_admin_form($form, &$form_state, ...) {
$form['source'] = array(
'#type' => 'textfield',
'#title' => t('Existing system path'),
'#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1.'),
'#field_prefix' => url(NULL, array('absolute' => TRUE)),
);
...
}
Comments
how to change your apache configuration to make this work...
#documentation
This is what I had in my httpd.conf for D7 (getting clean URLs to work).
This is what I had to put into my httpd.conf to get "not dirty" URLs to work in D8.
Yes!! Thank you. #1 worked
Yes!! Thank you. #1 worked for me. I just used:
Clean url's again.
If you add
RewriteBase /some/pathit seems to work just as well. Given the number of issues that have been opened and quickly closed the last year because someone expected the same behavior as D7 on clean url's, it would be nice if install put out a warning when a site is not configured for clean url's.
David Rocks
See issue https://drupal.org
See issue https://drupal.org/node/2094985 "Drupal 8 install does not warn if Clean Urls are not supported"