mod-rewrite

Unexpected request handling with substrings of existing folders

孤人 提交于 2019-12-12 04:34:18
问题 Let http://test.server/ be my current web server for testing purposes then I have a folder in there called Homepage which holds the code for the homepage (duh.). In the Homepage folder there are a some folders (like Templates ) which have .htaccess files with deny from all . In Homepage I do have a quite long .htaccess as well with the following contents: <IfModule mod_speling.c> CheckSpelling off CheckCaseOnly off </IfModule> Options -MultiViews RewriteEngine On RewriteBase /Homepage

htaccess rewrite rule not loading site content

你。 提交于 2019-12-12 04:28:57
问题 I am struggling with .htaccess rewrite rules. Let's say I have this URL. localhost/site/index.php and I want to rewrite it as this URL localhost/site/tutorial I would use this RewriteRule Options +FollowSymLinks RewriteEngine on RewriteRule ^tutorial/(.*)$ /up/index.php The page works, but the CSS files don't load. Also, if I have a URL like this: index.php?page=home Then I would have to parse through that URL to get 'home' not using $_GET anymore correct?? 回答1: Just use absolute URLs for

How to remove index.php from codeigniter on Bitnami MAMP stack

99封情书 提交于 2019-12-12 04:25:36
问题 I have been developing using Bitnami MAMP stack 5.6.19 on my Macbook I'm now ready to upload it to my server, but before that I want to remove the index.php from the site url and test it on my Mac so I can address any bugs. I have tried changing the httpd-app.conf, httpd-prefix.conf as suggested on the Bitnami site, but no luck. I get a 404 error from the page. Here is the httpd-app.conf I change AllowOverrite from None to All <Directory "/Applications/mampstack-5.6.19-0/frameworks

How to remove frontend/web from url in Yii2 advanced so that it doesn't appear when I use Url::to

旧巷老猫 提交于 2019-12-12 04:24:54
问题 I have written .htaccess files to prevent frontend/web from appearing in url but when I saet links through Url::to it appears in url. This is my .htaccess in root directory: <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On </IfModule> <IfModule mod_rewrite.c> # deal with admin first RewriteCond %{REQUEST_URI} ^/(admin) RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L] RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L] RewriteCond %{REQUEST_URI} !^/backend/web/(assets

Simple mod rewrite with no duplicate urls. It is possible?

天大地大妈咪最大 提交于 2019-12-12 04:23:14
问题 I have created simple mod rewrite # REMOVE WWW RewriteEngine On RewriteCond %{HTTP_HOST} ^www.mydomain.com$ [NC] RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L] # URL REWRITE RewriteEngine on RewriteRule ^design/?$ website-designing.php [L] Everything working fine. My question is at present both URLs are working. How to prevent this? mydomain.com/website-designing.php (my original URL) mydomain.com/design/ (my SEO URL) I want only SEO URL, same concept applied my all files in this

htaccess rewrite rule for specific domain

℡╲_俬逩灬. 提交于 2019-12-12 04:19:46
问题 So I have this rule that's working perfectly: RewriteRule ^images_designs/([^.]+)-d00([^/]+)\.png$ /image_design_watermark.php?design=$2 [L,QSA,NC] Now I would just add an additional "language" variable related to the domain the htaccess is used on I have tried this but it's not working: RewriteCond %{HTTP_HOST} ^(ni-dieu-ni-maitre|blablabla)\.com$ [NC] RewriteRule images_designs/([^.]+)-d00([^/]+)\.png$ /image_design_watermark.php?design=$2&language=fr [L,QSA,NC] RewriteCond %{HTTP_HOST} ^

301 redirect old parameter names to new parameter names by htaccess

橙三吉。 提交于 2019-12-12 04:18:58
问题 I just changed two parameter names and wanna redirect old names to changed name ones with any values anywhere in URL. e.g: product.php?colornew=anyvalue&productname=anyvalue 301 redirect to: product.php?color=anyvalue&product=anyvalue Please note that this is just an example and as I said these two parameter can be anywhere in URL with any value. 回答1: You can use this code to rename your query parameters in any URL: RewriteEngine On # rename query parameter colornew=>color RewriteCond %{QUERY

htaccess file mod_rewrite issue

烈酒焚心 提交于 2019-12-12 04:16:07
问题 Basically this is my structure: / - index.html - js files ( the ones making http requests to /api/ /api - api.php Basicly what im trying to do is to map requests to localhost/api/ to go to localhost/api/api.php I have tried with the following with no results: RewriteEngine On RewriteBase /api/ RewriteRule ^/?(api)/? /api/api.php [NC] RewriteCond %{REQUEST_METHOD} (PUT|DELETE) RewriteRule .* /api/api.php Can anyone help me? Summary: Right now when making http requests I have to set baseUrl to

Remove query string during a 301 redirect

不问归期 提交于 2019-12-12 04:15:32
问题 I'm trying to 301 the following url http://www.site.com/reviews/4f64d2862c16bf4ae40000b4?sort=all-positive to http://www.site.com/reviews By using RewriteRule ^reviews/([a-fA-f0-9]+)?$ http://www.site.com/reviews [L,R=301] But that redirects me to http://www.site.com/reviews?sort=all-positive How can I remove all query strings after what was the review id? Basically the question mark and everything after it needs to go. Any ideas? Thanks! 回答1: You have to use this RewriteRule: RewriteRule

htaccess rewrite rules for pagination not working

痴心易碎 提交于 2019-12-12 04:13:25
问题 I have the following in my htaccess: Options +FollowSymLinks -Multiviews -Indexes DirectoryIndex index.php RewriteEngine On RewriteBase / # To externally redirect /dir/file.php to /dir/file RewriteCond %{THE_REQUEST} \s/+(?:index)?(.*?)\.php[\s?] [NC] RewriteRule ^ /%1 [R=301,L,NE] # To internally forward /dir/file to /dir/file.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC] RewriteRule ^(.+?)/?$ $1.php [L] Now, I am trying to add some pagination rules