2

I'm trying to remove '#' from urls.

Using link with ui-sref or href attributes navigation works properly, but accessing directly to the same url, or refreshing page or pressing enter into url bar of the browser i get 404 not found error.

I enabled html5 mode:

$locationProvider.html5Mode(true);

Added base tag in head before any inclusion:

<base href="/folder/" />

Here is .htaccess file content (copied from angular-ui faq):

RewriteEngine on

# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ /folder/index.html [L]

Seems to be a problem related to .htaccess file.

What is wrong?

1 Answer 1

1

I've to:

  1. enable AllowOverride in /etc/apache2/apache2.conf (enable AllowOverride)
  2. enable mod_rewrite, from terminal a2enmod rewrite
  3. restart apache from terminal service apache2 restart
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.