Forums

.htaccess file location

I need to make some changes to .htaccess file and was wondering where can I locate it. I am trying to get rid of # in Angular/Django integration and as per this

https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag

article I need to overwrite .htaccess file in order to play nicely with Angular.

Hi there, there's no .htaccess file on pythonanywhere that you can edit I'm afraid. Depending on how badly you need this feature to work, you could perhaps re-implement it manually using python code in your web app itself?

Can you please guide a bit on how to create this file, where to put it?

I don't really know enough about angular and what it's trying to achieve I'm afraid... If you don't either, it might be simpler to give up on the "removing the hashtag" idea for now?

How to redirect https://nakedDomain to www.mydomain.com

Take a look at https://help.pythonanywhere.com/pages/NakedDomains/

Hi I'm interested in this.. I also want to make a rewrite rule for my urls

To leave a permanent url that looks like index.. This it's because I don't want users use the url bar to input any code or pk or slug

The best way to do that on PythonAnywhere is to add a route to your Python code to do the redirect. Exactly how you would do that depends on the framework that you're using -- that is, it would be different for Flask than it is for Django.

HI, I didn't pay full attention to my pythonanywhere URL and send an url with blanks. In this case the server doesn't response and the Http request is pending up to the end of time out. Is there a mean to check url syntax - on server side- to translate blanks and other forbidden chars in % sequences before Flask processing. ? Thanks

In general, if you enter a path in the URL that does not exist, then the server will respond with a 404. If yours does not, then you must have code to accept the path that was entered. In that case, you will need to add the code to verify that the path is in the correct form for your application.