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:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
#AllowOverride All
#AllowOverride AuthConfig FileInfo Indexes Limit Options=All, MultiViews
Order allow,deny
allow from all </Directory>
What should the file look like and should I create it myself?
Aslo I do have a 000-default.conf
file but the above 'code' isn't in there either.
apache2 .htaccess mod-rewrite
add a comment |
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:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
#AllowOverride All
#AllowOverride AuthConfig FileInfo Indexes Limit Options=All, MultiViews
Order allow,deny
allow from all </Directory>
What should the file look like and should I create it myself?
Aslo I do have a 000-default.conf
file but the above 'code' isn't in there either.
apache2 .htaccess mod-rewrite
add a comment |
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:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
#AllowOverride All
#AllowOverride AuthConfig FileInfo Indexes Limit Options=All, MultiViews
Order allow,deny
allow from all </Directory>
What should the file look like and should I create it myself?
Aslo I do have a 000-default.conf
file but the above 'code' isn't in there either.
apache2 .htaccess mod-rewrite
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:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
#AllowOverride All
#AllowOverride AuthConfig FileInfo Indexes Limit Options=All, MultiViews
Order allow,deny
allow from all </Directory>
What should the file look like and should I create it myself?
Aslo I do have a 000-default.conf
file but the above 'code' isn't in there either.
apache2 .htaccess mod-rewrite
apache2 .htaccess mod-rewrite
asked Feb 15 '14 at 13:20
inControlinControl
168129
168129
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
For apache version 2.4 and later, you have to go to
/etc/apache2/apache2.conf
You have to edit that file (you should have root permission). Change directory text like this;
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Now restart apache.
service apache2 restart
Hope it works.
Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.
– chx101
Apr 16 '17 at 10:04
The important line here isAllowOverride All
, this means all settings can be set (overridden) in.htaccess
files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride
– jacwah
Nov 27 '18 at 15:59
add a comment |
Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.
firstly enable a2enmod
sudo a2enmod rewrite
and
sudo service apache2 restart
sudo nano /etc/apache2/sites-enabled/000-default.conf
add these lines at end
<Directory /var/www/html>
AllowOverride All
</Directory>
and
sudo service apache2 restart
1
This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.
– kishor10d
Sep 29 '17 at 18:16
1
This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.
– Faisal Sarfraz
Sep 7 '18 at 7:51
add a comment |
If you don't want to repeat the same configurtion at each upgrade / update
The best way is :
Edit or create a config file
/etc/apache2/conf-available/httpd.conf
Add
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Enable the config file
sudo a2enconf httpd
Restart or reload Apache
sudo service apache2 restart
or
sudo service apache2 reload
It's done!
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f421233%2fenabling-htaccess-file-to-rewrite-path-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
For apache version 2.4 and later, you have to go to
/etc/apache2/apache2.conf
You have to edit that file (you should have root permission). Change directory text like this;
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Now restart apache.
service apache2 restart
Hope it works.
Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.
– chx101
Apr 16 '17 at 10:04
The important line here isAllowOverride All
, this means all settings can be set (overridden) in.htaccess
files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride
– jacwah
Nov 27 '18 at 15:59
add a comment |
For apache version 2.4 and later, you have to go to
/etc/apache2/apache2.conf
You have to edit that file (you should have root permission). Change directory text like this;
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Now restart apache.
service apache2 restart
Hope it works.
Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.
– chx101
Apr 16 '17 at 10:04
The important line here isAllowOverride All
, this means all settings can be set (overridden) in.htaccess
files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride
– jacwah
Nov 27 '18 at 15:59
add a comment |
For apache version 2.4 and later, you have to go to
/etc/apache2/apache2.conf
You have to edit that file (you should have root permission). Change directory text like this;
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Now restart apache.
service apache2 restart
Hope it works.
For apache version 2.4 and later, you have to go to
/etc/apache2/apache2.conf
You have to edit that file (you should have root permission). Change directory text like this;
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Now restart apache.
service apache2 restart
Hope it works.
edited 3 mins ago
Ali Çarıkçıoğlu
1032
1032
answered Feb 15 '14 at 13:27
NabilNabil
1,49711427
1,49711427
Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.
– chx101
Apr 16 '17 at 10:04
The important line here isAllowOverride All
, this means all settings can be set (overridden) in.htaccess
files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride
– jacwah
Nov 27 '18 at 15:59
add a comment |
Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.
– chx101
Apr 16 '17 at 10:04
The important line here isAllowOverride All
, this means all settings can be set (overridden) in.htaccess
files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride
– jacwah
Nov 27 '18 at 15:59
Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.
– chx101
Apr 16 '17 at 10:04
Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.
– chx101
Apr 16 '17 at 10:04
The important line here is
AllowOverride All
, this means all settings can be set (overridden) in .htaccess
files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride– jacwah
Nov 27 '18 at 15:59
The important line here is
AllowOverride All
, this means all settings can be set (overridden) in .htaccess
files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride– jacwah
Nov 27 '18 at 15:59
add a comment |
Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.
firstly enable a2enmod
sudo a2enmod rewrite
and
sudo service apache2 restart
sudo nano /etc/apache2/sites-enabled/000-default.conf
add these lines at end
<Directory /var/www/html>
AllowOverride All
</Directory>
and
sudo service apache2 restart
1
This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.
– kishor10d
Sep 29 '17 at 18:16
1
This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.
– Faisal Sarfraz
Sep 7 '18 at 7:51
add a comment |
Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.
firstly enable a2enmod
sudo a2enmod rewrite
and
sudo service apache2 restart
sudo nano /etc/apache2/sites-enabled/000-default.conf
add these lines at end
<Directory /var/www/html>
AllowOverride All
</Directory>
and
sudo service apache2 restart
1
This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.
– kishor10d
Sep 29 '17 at 18:16
1
This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.
– Faisal Sarfraz
Sep 7 '18 at 7:51
add a comment |
Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.
firstly enable a2enmod
sudo a2enmod rewrite
and
sudo service apache2 restart
sudo nano /etc/apache2/sites-enabled/000-default.conf
add these lines at end
<Directory /var/www/html>
AllowOverride All
</Directory>
and
sudo service apache2 restart
Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.
firstly enable a2enmod
sudo a2enmod rewrite
and
sudo service apache2 restart
sudo nano /etc/apache2/sites-enabled/000-default.conf
add these lines at end
<Directory /var/www/html>
AllowOverride All
</Directory>
and
sudo service apache2 restart
answered Jun 2 '17 at 21:04
alicanozkaraalicanozkara
27124
27124
1
This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.
– kishor10d
Sep 29 '17 at 18:16
1
This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.
– Faisal Sarfraz
Sep 7 '18 at 7:51
add a comment |
1
This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.
– kishor10d
Sep 29 '17 at 18:16
1
This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.
– Faisal Sarfraz
Sep 7 '18 at 7:51
1
1
This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.
– kishor10d
Sep 29 '17 at 18:16
This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.
– kishor10d
Sep 29 '17 at 18:16
1
1
This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.
– Faisal Sarfraz
Sep 7 '18 at 7:51
This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.
– Faisal Sarfraz
Sep 7 '18 at 7:51
add a comment |
If you don't want to repeat the same configurtion at each upgrade / update
The best way is :
Edit or create a config file
/etc/apache2/conf-available/httpd.conf
Add
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Enable the config file
sudo a2enconf httpd
Restart or reload Apache
sudo service apache2 restart
or
sudo service apache2 reload
It's done!
add a comment |
If you don't want to repeat the same configurtion at each upgrade / update
The best way is :
Edit or create a config file
/etc/apache2/conf-available/httpd.conf
Add
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Enable the config file
sudo a2enconf httpd
Restart or reload Apache
sudo service apache2 restart
or
sudo service apache2 reload
It's done!
add a comment |
If you don't want to repeat the same configurtion at each upgrade / update
The best way is :
Edit or create a config file
/etc/apache2/conf-available/httpd.conf
Add
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Enable the config file
sudo a2enconf httpd
Restart or reload Apache
sudo service apache2 restart
or
sudo service apache2 reload
It's done!
If you don't want to repeat the same configurtion at each upgrade / update
The best way is :
Edit or create a config file
/etc/apache2/conf-available/httpd.conf
Add
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Enable the config file
sudo a2enconf httpd
Restart or reload Apache
sudo service apache2 restart
or
sudo service apache2 reload
It's done!
edited Dec 2 '18 at 22:43
answered Sep 23 '15 at 15:34
zataminezatamine
32638
32638
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f421233%2fenabling-htaccess-file-to-rewrite-path-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown