mod-rewrite

Using .htaccess to redirect http://, http://www., and https://www. to https://

做~自己de王妃 提交于 2019-12-24 14:00:30
问题 It looks like various permutations of this question have been asked before, but it looks like all of the answers have specific idiosyncrasies that don't apply to my situation, or just don't work. So, here's what I'm after... I would like these three URLs: http://example.com http://www.example.com https://www.example.com ... To all redirect to: https://example.com From another answer, I tried this; <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC

simple mod_rewrite redirects

浪子不回头ぞ 提交于 2019-12-24 13:40:21
问题 After a lot of research and some help, I managed to learn a bit of how mod rewrite works... Can someone tell me what's wrong with my code bellow? ######redirect all static files to the static domain RewriteCond %{REQUEST_URI} ^/(.+)\.(gif|png|jpg|jpeg|jfif|bmp|css|js)$ [NC] RewriteRule ^(.*)$ http://static.example.com/$1 [R=301,L] ######redirect naked to www RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule (.*) http://www.example.com/$1 [R=301,L] ######redirect IP to www RewriteCond %

HTAccess Rewrite based upon a Parameter Value, ignore other Parameters

為{幸葍}努か 提交于 2019-12-24 13:17:41
问题 another HTAccess rewrite issue, sorry.... I'm trying to rewrite all URL's that have menuid=28421, menuid=27384 and menuid=73841. The issue is that the menuid is part of a longer query string, but not all parameters are present in the query string. I want to rewrite only based on the value of menuid, and ignore the other parameters. http://www.domain.com/shop.php?menuid=28421&menuref=Ja&menutitle=New+Products&limit=5&page=8 http://www.domain.com/shop.php?menuid=27384&menuref=Ic&menutitle=Old

PHP MVC Application loosing path references to jss and css files

不想你离开。 提交于 2019-12-24 12:56:14
问题 I´m writing my own PHP MVC framework. So, the entry point for bootstrapping is at myapp/public/index.php . There I check the URL passed, as: $url = $_GET["url"]; And then I explode the code finding the necessary controller, action and parameters to navigate: $parts = explode("/", trim($url, "/")); if (sizeof($parts) > 0) { $controller = $parts[0]; if (sizeof($parts) >= 2) { $action = $parts[1]; $parameters = array_slice($parts, 2); } } From here the code loads and runs the controller and view

How to change below rewrite url to allow more sub folder, when all url redirected to index page?

ぃ、小莉子 提交于 2019-12-24 12:43:52
问题 I am trying to change the below rewrite rule to accept more folders. Currently any other url else mydomain.com\test will be directed to index.php . RewriteRule ^((?!test).)*$ index.php [QSA,L] I need to add more subfolders like test1 , test2 etc. So that I can access url \test1 , \test2 etc. Rewrite Rule RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^((?!test).)*$ index.php [QSA,L] 回答1: Well... What you have already also matches /test1

how to Rewrite Single Page url in .htaccess

风流意气都作罢 提交于 2019-12-24 12:34:52
问题 I need to rewrite only 1 specific URL from http://www.domainname.com/index.php?route=payment/axis/callback to http://www.domainname.com/payment/axis/callback I tried these two from stack overflow, I don't know why its not working 1st one : RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?route=payment/axis/callback [NC,L] 2nd one : RewriteRule ^index.php?route=payment/axis/callback payment/axis/callback [L] 回答1: Try this: 4) Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz Have you

Mod-Rewrite REGEX not working Apache

大兔子大兔子 提交于 2019-12-24 12:34:09
问题 I am trying to get the following working: When a user uses a search box, the get sends the user to www.example.com/search/?s=Query+String Sending the GET request is not a problem, however, grabbing it via a RewriteRule is. I'm not sure my REGEX is proper in this case. RewriteRule ^search/\?s=(.*[^/])$ search.php?s=$1 [NC,L] What needs to happen is that the /search/?s=Query+String Query string part has to be taken from that url and sent over to search.php?s=Query+String via the Rewrite Rule

How to filter all Apache URL containing string but not containing a substring

99封情书 提交于 2019-12-24 12:28:01
问题 I'm trying to filter all clients (using .htaccess) who try to access addresses containing for instance path=\ in the URL, but not those URL's that contain _wpnonce=1234567890 . The logic is: block all but those who also have the _wpnonce parameter. The blocking, without testing if it contains the substring looks like this: RewriteCond %{QUERY_STRING} (menu|mod|path|tag)\=\.?/? [NC,OR] Is there a way to also include my substring negation there? 回答1: The documentation says that the pattern is a

htaccess redirect a plus sign

女生的网名这么多〃 提交于 2019-12-24 12:26:37
问题 I try to make a redirect of a URL from my old site to my new site, but it does not work. I think that the plus symbol is giving me problems. RewriteRule ^nl/pageid/junair+compressor+onderhoud(|/)$ /nl/persluchttechniek/page/nieuwsberichten/compressor-onderhoud-junair [R=301,L] 回答1: Try this redirect rule in your root .htaccess of old site: RewriteRule ^nl/pageid/junair[\s+]compressor[\s+]onderhoud/?$ /nl/persluchttechniek/page/nieuwsberichten/compressor-onderhoud-junair [NC,B<R=301,L] Make

Autoload php classes from subfolders using underscore (PEAR style) notation

爱⌒轻易说出口 提交于 2019-12-24 12:23:05
问题 I'm a bit new to Object Oriented PHP and MVC's so I really need some help please. I have an MVC style folder structure with subfolders in the filesystem - e.g. view/classes/subfolder/classname.php I'm using mod_rewrite for human friendly URL's, as /classname or /foldername/calssname , which are then passed to a page loader as underscore separated values. - e.g. foldername_classname // Page Loader File require_once($_SERVER['DOCUMENT_ROOT'].'/local/classLoader.php'); session_start(); $page =