modrewrite on cshtml files are ignored by mod_mono - .htaccess

I've got mod_mono and mono installed on my webserver and I'm trying to get this simple modrewrite working, however it seems to be ignored by mod mono.
RewriteEngine on
RewriteRule ^Projects/page1.cshtml$ /project2 [PT]
I have that in my .htaccess in the document root. If I use any other extension besides .cshtml, it works as intended. Any ideas?

Related

Rewrite Rules Not Working in MAMP Pro Development Environment for Production Images

When working on a project, I would like to use the online images, so I don't have to download e.g. all images (as described here).
To achieve this, I wrote a view lines in my .htaccess-file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} 8890
RewriteRule ^wp/media/.+ https://www.example.com:443%{REQUEST_URI}
</IfModule>
According to htaccess.madewithlove.be this should convert an image url from:
https://example.localhost:8890/wp/media/27442.jpg
to:
https://www.example.com/wp/media/27442.jpg
Context:
MacBook Pro
OS X Catalina 10.15.2
MAMP Pro 5.5.1
WordPress 5.3.2
example.localhost:8890 (SSL) up and running
local website is working fine
What I already tried/verified/adjusted:
How to get htaccess to work on MAMP
mamp pro htaccess rewriteRule not working
https://wordpress.stackexchange.com/questions/346778/rewrite-rule-to-load-images-from-production-does-nothing?rq=1
The .htaccess is being executed. When entering garbage, I got a error 500
Changed httpd.conf accordingly
Am I missing something? What else could prevent this from working?
The problem was that I had another .htaccess-file inside the wp-folder, because I moved the WordPress installation into its own directory (see here). When moving the rules into this inner .htaccess-file, it started working immediately.

Migrating CodeIgniter from WAMP to Ubuntu 12.04 LTS LAMP

After I successfully installed Ubuntu 12.04 LTS LAMP on my local machine, following this TUT. And installed phpmyadmin with this instruction. I migrated my working CodeIgniter project inside /var/www/ and updated my database. Everything seems to be working fine except i'm having a 404 error saying:
GET http://192.168.1.11/quantum/login/ 404 (Not Found)
The following error occured: error Not Found
GET http://192.168.1.11/quantum/user/ 404 (Not Found)
The following error occured: error Not Found
After hours of desperate troubleshooting I found some possible causes.
.htaccess (already updated)
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
mod_rewrite (already enabled)
but still, i cant seem to make it work. any ideas? is there more to be configured to make the project running?
(dumb) Have you checked all folders have successfully been copied?
Have you changed your base_url in the config file? (/application/config/config.php)
When mod_rewrite is enabled (to remove the index.php in the URL), your index_page item in the config file must be blank.
If you have already checked these things, try disabling mod_rewrite in order to track if this is your issue.
Turns out I forgot to reconfigure my htaccess by allowing override on my httpd.conf inside apache2.
<Directory /var/www/quantum>
AllowOverride All
</Directory>
Works like peanut butter and jelly.

Custom URL rewriting not working in codeigniter

I use the code below in a Codeigniter htaccess file
RewriteRule ^([^.]+)-vacation$ /search?location=$1
When i access it with the url www.example.com/moscow-vacation,
it gives me a 404 error.
I have used the above htaccess code in a core php application. It works fine there.
Most likely, you don't have a search script. If the script is named search.php, you can use this slightly modified rule
RewriteRule ^([^.]+)-vacation$ /search.php?location=$1
If you have a controller named Search with a method location, you can either rewrite directly to
RewriteRule ^([^.]+)-vacation$ index.php/search/location/$1
or try
RewriteRule ^([^.]+)-vacation$ search/location/$1

url rewriting asp .htaccess file

I just moved my website (asp.net) to the live environment. I realized they are running IIS 6 so all my nice and clean url rewriting doesn't work anymore. I was trying to implement URL rewriting using the .htaccess file.
I want to rewrite:
www.amicobio.co.uk/Menu.aspx to www.amicobio.co.uk/Food-Menu
So in .htaccess I set:
CaseInsensitive On
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^Food-Menu$ Menu.aspx
But it doesn't work it says:
The requested URL
/a/m/amicobio.co.uk/public/Menu.aspx
was not found on this server.
Obviously the path is wrong but what is /a/m/ and how do I fix it? All the files in amicobio.co.uk/public/
Thanks.
I found the solution
it was
RewriteRule ^Food-Menu /Menu.aspx
in stead of
RewriteRule ^Food-Menu$ Menu.aspx

.htaccess not working on my server

I'm working on my project and now I want to transfer it from my localhost to server. Everything seems to work fine, but .htaccess doesn't work.
The server should be suporting mod_rewrite and print_r(apache_get_modules()); shows mod_rewrite running.
But still, when I type myaddress.com/contact, it shows error 404.
Here is the .htaccess file, but it should be fine, since it runs on my localhost:
RewriteEngine on
RewriteRule ^adminator/?$ adminator/login.php [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&detail=$2 [L]
RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L]
Do you have any idea?
Thanks, Mike.
Does the server allow .htaccess? It doesn't really have to.
Try other directives, ask your hosting provider, or check the configuration yourself if possible.
I tried testing your rules they should be fine on urls such as: http://myhost.com/test1 and http://myhost.com/test1/test2 result in requesting url: index.php?page=test1 and index.php?page=test1&detail=test2
So the problem is not your rules, it is your server setup somewhere. As Mewp said check your Apache config file, look for AllowOverride which should be enabled for .htaccess files to overriding default settings.
Ok, fixed it .. deep in the hostings settings, there was an option to activate it .. but I found it after 4 hours of looking around .. :P

Resources