mod-rewrite

Adding a Parameter at End of all url matching a format through Htaccess

对着背影说爱祢 提交于 2019-12-12 22:55:48
问题 Pl advise Pl advise, how to add Itemid=13 on end of all url matching by making 301 redirect index.php?option=com_usedtoy&view=post&id=**variable** For ex Incorrect URL www.abc.com/index.php?option=com_usedtoy&view=post&id=495 www.abc.com/index.php?option=com_usedtoy&view=post&id=497 www.abc.com/index.php?option=com_usedtoy&view=post&id=510 Correct URL www.abc.com/index.php?option=com_usedtoy&view=post&id=495&Itemid=13 www.abc.com/index.php?option=com_usedtoy&view=post&id=497&Itemid=13 www.abc

htaccess url rewriting, ignoring files

↘锁芯ラ 提交于 2019-12-12 22:32:20
问题 I am trying to come up with a rewrite rule, but I am having problems. What I need - any url that starts with /services/XXX to be redirected to /services/api.php?service=XXX I also want to ignore any files or folders that might also match. What I have so far: RewriteRule ^services/([a-z]+)$ /services/api.php?service=$1 [NC, L] But this does not work at all, it shows a 404 page saying that file is missing when I test it. Any help is much appreciated. 回答1: To ignore the files that exists just

How can I .htaccess 301 redirect all pages/files (except for one) to new domain?

一曲冷凌霜 提交于 2019-12-12 21:22:14
问题 How can I .htaccess 301 redirect all pages/files (except for one) to new domain? I have already made an .htaccess file that successfully redirects most all the different pages and files on my old domain (www.olddomain.com) to my new domain (www.newdomain.com). However, I need one page to not be redirected to the new site, that page is the Google verification .html file: http://www.olddomain.com/googleverification.html I have attached the most relevant parts of the file (.htaccess) pasted

htaccess redirect to “https://www.”

丶灬走出姿态 提交于 2019-12-12 21:13:16
问题 I would like to make a redirection to https://www. Which means that: http:// --> https://www. http://www. --> https://www. https:// --> https://www. https://www. --> no redirection I tried plenty of things but never reached that goal. my current .htacces : <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} =http RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ web/$1 [QSA,L] </IfModule> But the

https in htaccess and order of rules (using Expression Engine)

天大地大妈咪最大 提交于 2019-12-12 21:12:39
问题 I'm building a site in expression engine that part of needs to be https. The site is also using a new domain name (new one www.example-new.com the old one www.example.old.com). I want to do the following things: remove the index.php force www force https for any url starting www.example.old.com/extranet redirect https URLs that are not www.example.old.com/extranet (e.g. www.example.old.com/news to http I have the following code so far that works for the first two requirements: <IfModule mod

Wamp, SlimPHP and Htaccess

牧云@^-^@ 提交于 2019-12-12 21:07:11
问题 I am having issues with getting Slim to recognize the following: $app = new \Slim\Slim(); $app->get('/', function () { echo "Hello"; }); $app->get('/:name', function () { echo "Hello"; }); $app->run(); It will see the first route just fine, how ever the second one returns a Not Found The requested URL /image-uploader/gg was not found on this server. Which lead me to believe I didnt have the re-write mod enabled in wamp. So I enabled it and set AllowOverride to All I then restarted wamp and

.htaccess: How to remove subfolder's subfolder in URL?

本小妞迷上赌 提交于 2019-12-12 20:47:00
问题 I'm trying to redirect this URL www.domain.com/~username to www.domain.com/~username/public but remove the /public from the URL. This is my .htaccess file <IfModule mod_rewrite.c> RewriteEngine on RewriteBase /~username/ RewriteRule !^public/ public%{REQUEST_URI} [L] RewriteCond %{THE_REQUEST} ^GET\ /public/ RewriteRule ^public/(.*) /$1 [L,R=301] </IfModule> But I'm getting this error: Not Found The requested URL /~username/public/~username/ was not found on this server. Any help appreciated!

Mod_Rewrite for URL with multiple variables

橙三吉。 提交于 2019-12-12 20:23:49
问题 I have the following code in my .htaccess RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?mode=$1&%{QUERY_STRING}) It works great for one variable but I want to pass some additional variables and would like them to so up like the first one. So instead of having /about/?anotherVar=extra I have /about/extra. The additional variable would be on some pages not all I now have: #<IfModule mod_rewrite.c> # RewriteEngine on # RewriteCond %{REQUEST_FILENAME} !-f # RewriteCond %{REQUEST_FILENAME} !-d #<

How to redirect one domain to another

两盒软妹~` 提交于 2019-12-12 20:19:04
问题 I have two domains: www.example1.com/ --> IP=1.2.3.4 www.example2.com/ --> IP=1.2.3.4 (same IP for both domains) I want all requests that go to www.example2.com/* to access the requested page. I want all requests that go to www.example1.com/* to redirect to www.example2.com/* . How would I do this in apache? As now I am currently doing this in javascript. 回答1: put this code in your DOCUMENT_ROOT/.htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?example1\.com [NC] RewriteRule

URL extension hiding : rewrite vs redirect

落爺英雄遲暮 提交于 2019-12-12 20:08:32
问题 I have read lots of question and answers but i cant decide which one is better or how to use a combination of these ways of extension hiding. what i want is to have a url rewriting like stackoverflow ! so what else should i do to have these rules: url: example.com/file.anyEXT... show content of => 404 url: example.com/unknown-Cat... show content of => 404 url: example.com/cat1 show content of => example.com/cat1/index.php url: example.com/cat1/index.php show content of => 404 url: example.com