url-rewriting

Rewrite url in .htaccess, dummy paths don't lead to 404 page but expose PHP warnings

醉酒当歌 提交于 2019-12-11 04:17:53
问题 I have these custom .htaccess redirections # Add a trailing slash to folders that don't have one RewriteCond %{REQUEST_URI} !(/$|\.) RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] # Exclude these folders from rewrite process RewriteRule ^(admin|ajax|cache|classes|css|img|webassist|js)($|/) - [L] # Redirect root requests to /home/ folder RewriteRule ^(/home/)?$ /home/index.php?nLang=it [NC,L] # Start rewriting rules RewriteRule ^risultati.htm$ /home/results.php [NC,L,QSA] RewriteRule ^sfogliabile/

URL-rewriting in web.config not working for Slim PHP API in subdirectory

烈酒焚心 提交于 2019-12-11 03:55:10
问题 I developed the backend application using the WAMP stack (Windows + Apache + MySQL + PHP) and SlimPHP micro framework. It is working perfectly with WAMP but now I have to make it work in a server that is using IIS v7.5 and I'm getting an HTTP 404 error. The frontend is an AngularJS application located in the root directory (no problem here) that uses the data obtained from the SlimPHP API located in the /api/v0 subdirectory. Here is the structure of my web-app: Project |--index.html |--styles

NGINX - url rewrite regular expression

谁说胖子不能爱 提交于 2019-12-11 03:44:07
问题 I have the url such as example.com/page.php?username=test . I want to rewrite this url into something like: example.com/test only if test follows the following regual expression: /^[0-9a-zA-Z_-]{1,35}+$/ , else 404 page. 回答1: Try this: # output: example.com/test rewrite ^/([A-Za-z0-9_]+)$ /page.php?username=$1; UPDATE: {1,35} This expression allow from 1 to 35 character {20} That have to exactly 20 character The + say minimum 1 character The correct full rewrite rule: # output: example.com

.htaccess rewrite file path to folder path

爷,独闯天下 提交于 2019-12-11 03:42:20
问题 I have a subdirectory contact and inside contact.php and contact_content.php and .htaccess file In .htaccess file I have following code: Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_URI} ^/contact/contact.php RewriteRule ^ /contact [R=301,L] RewriteRule ^/$ contact.php [NC,L,END] # deny access RewriteRule ^(contact_content)\.php - [F,L,NC] Deny access part and the first rewrite rule work perfectly but the problem is the second rewriterule-> when I go to localhost/contact I

Aliasing a URL inside a custom ASP MVC Route

徘徊边缘 提交于 2019-12-11 03:40:00
问题 I'm creating URL aliasing functionality; the ability to map resource A to resource B. I'm fitting this into a project with a catch-all URL mapped to a custom Route that parses the incoming URL string and looks up the URL parts inside our database. Basically, the entire URL string is dynamic and maps to a category hierarchy (e.g. /tyres/car /tyres/van, /suspension/ford/focus). This is all working fine, and only exists to route to one controller. Currently I'm integrating my code for URL

IIS URL rewrite rule redirect with mask?

做~自己de王妃 提交于 2019-12-11 03:33:36
问题 I have a URL like this: http://www.example.com/erf4d (where erf4d can be any 5 character string) I want to redirect the user to: http://www.example.com/viewentry.aspx?ID=erf4d I have accomplished this using rewrite rules in web.config however I would like it so that http://www.example.com/erf4d stays in the URL bar such that the user dosen't see the "ugly" viewentry.aspx?ID=erf4d a sort of redirect mask if you will. Is there anyway to accomplish this? 回答1: In my experience URL rewrite is used

Intelligencia URLRewriter for non existent or non aspx pages

╄→гoц情女王★ 提交于 2019-12-11 03:05:44
问题 I am trying to redirect all non existent pages to a different domain, as my blog was moved to a different domain. So www.mydomain.com/blog/asdf should redirect to blog.mydomain.com/blog/asdf Using Intelligencia URLRewriter module I can redirect blog/ but if I do blog/something I get a 404. Even with a simple rule without regex like this one, it doesn't work for anything under the blog folder <rewrite url="~/blog/^" to="http://blog.softwaresynergy.com/blog/" /> I also tried this to force all

How to Remove index.php from URL in PHP

杀马特。学长 韩版系。学妹 提交于 2019-12-11 02:59:58
问题 I want to remove index.php from url but so far i couldn't succeed it. I'm using Wamp server on my local and Apache on remote server.. In local root directory, my project files are located in a subfolder like www/project/index.php I can access web pages like localhost/project/index.php/home localhost/project/index.php/messages/?mId=3 I just want to access it like localhost/project/home localhost/project/messages/?mId=3 I already tried some .htaccess rewrite rule but couldnt make it. 回答1: Here

How to use # sign as an anchor while url rewriting with .htaccess on apache?

北战南征 提交于 2019-12-11 02:55:31
问题 i have .htaccess that works fine with shorty rewriting rules like RewriteRule ^blog/(.+)$ blog_post.php?blogSEOBaslik=$1 [L] But there is a page about.php which includes subnavigation via <li><a href="#resume"> named anchor. When i apply a rule like: RewriteRule ^about/(.+)$ about.php\#$1 [L] not behave as usual, standart about.php#resume anchor do. How do i use named anchors in url rewriting rules? 回答1: Use NE flag for not encoding the resulting URL: RewriteEngine On RewriteBase /BAH/

Rewrite URL on Glassfish with Quercus' PHP

自闭症网瘾萝莉.ら 提交于 2019-12-11 02:34:23
问题 I have Glassfish 3 server and have added Quercus 4.0.7 to to be able to run PHP applications on it. Everything works perfectly with it. Now I'm trying to run Question2Answer application on my server. I was able to open application but it's not allowing me to navigate from page to page because they are using .htaccess file to rewrite the URL. I was wondering how do we rewrite the URL in this case? Here is what Question2Answer's .htaccess has inside: DirectoryIndex index.php RewriteEngine On