mod-rewrite

.htaccess: Rewrite rule issue, how to redirect all to admin panel

喜欢而已 提交于 2020-01-05 00:50:07
问题 I want to redirect my website to admin panel Like localhost/website/ => localhost/website/admin localhost/website/login => localhost/website/admin localhost/website/blog => localhost/website/admin Here is my created rule RewriteEngine on RewriteCond $1 !^(index\.php) RewriteRule ^(.*)$ /website/admin/$1 [L] But this is not working 回答1: The following code will redirect everything to your admin page, keeping the attributes. This also applies to files who already exist ! RewriteEngine On

mod_rewrite redirect from .png to .php

吃可爱长大的小学妹 提交于 2020-01-04 19:42:54
问题 I have: http://www.site.tk/track/aaaa.png I want all .png files that are accessed from that folder to redirect to: http://www.site.tk/track/track.php So when I insert no matter what png file from that folder in another website using: <img src="http://www.site.tk/track/bbbb.png"> The user will see the content of the "track.php" I tryed: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase track RewriteRule ^([A-z0-9]{6}).png /track.php I used "RewriteBase track" because the

mod_rewrite redirect from .png to .php

此生再无相见时 提交于 2020-01-04 19:42:07
问题 I have: http://www.site.tk/track/aaaa.png I want all .png files that are accessed from that folder to redirect to: http://www.site.tk/track/track.php So when I insert no matter what png file from that folder in another website using: <img src="http://www.site.tk/track/bbbb.png"> The user will see the content of the "track.php" I tryed: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase track RewriteRule ^([A-z0-9]{6}).png /track.php I used "RewriteBase track" because the

url redirecting using .htaccess

泄露秘密 提交于 2020-01-04 14:29:32
问题 I need your help to make some url redirection using .htaccess The case is that I have url like www.website.com/index.php?chID=1234 which opens particular tv channel on the website. The problem is that I want to make these urls like www.website.com/channel-name/1234 (where 1234 is that chID variable, to get record from the database, of course without it would be more nice). here is the working link - http://www.livepage.info/world-tv-channels.php?chID=1512 any suggestion will be greatly

Why does my rewrite rule disables additional $_GET data?

我的未来我决定 提交于 2020-01-04 13:08:11
问题 I'm using this rewrite rule for my whole domain: RewriteRule ^([A-Za-z0-9/-]+)$ /index.php?path=$1 So for example, my urls look like this: http://www.example.com/page/subpage/4/anything/ The problem is when I want to manually add a specific $_GET , like this: http://www.example.com/page/subpage/4/anything/?also=admin I remember this has worked on some sites I've been developing, but it doesn't work here. How can I fix my RewriteRule so that I can add $_GET data like this? 回答1: Use Query

Mod Rewrite and passing a URL as parameter

廉价感情. 提交于 2020-01-04 09:26:23
问题 I am having a small trouble with mod rewrite. A friend of mine is writing a script that allows you to upload images. What we want to do is allow the user to append a domain name to a direct image link, and the script would retrieve the image from the supplied URL. For example, if the image is at: http://www.test.com/image.jpg, adding domain.com /http://www.test.com/image.jpg would allow a script to retrieve that url (test.com) to get the image we want. EDIT: HTTP is in front of the URL

Retain query string on rewrite .htaccess

一世执手 提交于 2020-01-04 06:00:56
问题 I currently have a simple rewrite that redirects /photos/2 to /photoviewer.php?photo=2 However I need to be able to allow the user to add a photo to their cart so I was thinking I need to retain the query string so that the following works. /photos/2?action=purchase redirects to: /photoviewer.php?photo=2&action=purcahse My current htaccess rule is: RewriteRule ^photos/([a-zA-Z0-9_-]+)$ photoviewer.php?photo=$1 [L] 回答1: Append the [QSA] flag (query string append). RewriteRule ^photos/([a-zA-Z0

mod_rewrite rule not working

試著忘記壹切 提交于 2020-01-04 05:46:27
问题 I have the following rules in my htaccess: RewriteRule ^([^/.]+)/?$ list.php?categoryShortForm=$1&locationShortForm=world [QSA] RewriteRule ^([^/.]+)/([^/.]+)/?$ list.php?categoryShortForm=$1&locationShortForm=$2 [QSA] RewriteRule ^([^/.]+)/([^/.]+)/[^/.]*-p([0-9]+)/?$ view.php?categoryShortForm=$1&locationShortForm=$2&postingId=$3 [QSA] In my localhost (windows, xampp), it all works fine. In my real server (linux, apache) the first 2 rules work fine, but not there 3rd one. For example:

URL rewrite for Subdomain

一个人想着一个人 提交于 2020-01-04 05:18:28
问题 The situation is simple. I create a wildcard subdomain in my cpanel that goes something like this: *.mysite.com. I can load the page but I want to take the value of the wildcard as a parameter of GET so the page can actually display the relevant contents based on that GET value. So what i want to know is if its possible to have a rewrite rule that allows me to do the following. Get: $_GET['store']=='andystore' from the url: http://andystore.mysite.com 回答1: You can use this code in your

Absolute file paths in mod_rewrite - allowed?

久未见 提交于 2020-01-04 04:16:07
问题 This is a follow-up to this question. I am trying to build a mod_rewrite rule where the rewriting target is an absolute path outside the web root, like RewriteRule ^manual(/(.*))?$ /www/htdocs/customername/manual/$2 [L] I need to do this because I can't use Alias in a .htaccess context (shared hosting). There are responses hinting at this not being possible at all. Is this true? I can't find any clear info in the manual. Could somebody clarify when absolute paths are possible, and when they