mod-rewrite

How to Change 302 Redirect to 301 Redirect in htaccess?

天大地大妈咪最大 提交于 2020-01-07 02:20:07
问题 Here's the code I have in my .htaccess: Options +FollowSymlinks RewriteEngine on RewriteBase /special/service RewriteRule ^(.+)$ http://clients.example.com/aff.php?aff=$1&p=service.php [R,NC] When I go the my redirect while running FireBug I'm seeing that it's actually a 302 redirect for some reason. What do I need to change to fix this? 回答1: Add a =301 in your flags: Options +FollowSymlinks RewriteEngine on RewriteBase /special/service RewriteRule ^(.+)$ http://clients.example.com/aff.php

How can I get use outside information in url rewrites?

这一生的挚爱 提交于 2020-01-07 00:36:10
问题 Hopefully some of you .htaccess gurus can help me out with this one. I have never spent any time messing around with .htaccess before, so I'm a bit lost. Basically I want to take a link such as example.com/index.php?id=3 and convert it to http://example.com/pagename/ I can easily change it so that the link converts to http://example.com/directory/3 or something along those lines, but I don't really understand how people accomplish the change I'm looking for. I know that Wordpress does

Cannot remove index.php from url CI based site

与世无争的帅哥 提交于 2020-01-06 20:28:13
问题 I have Code Igniter based site and I have it on ubuntu 12.04 in /var/www/mysite folder My ubuntu serves as a server so I access my site trough other computer, but both computers are on LAN network. I use http://xxx.yyy.zzz.ttt/mysite url to access it. The problem I have is that I cannot use url without "index.php" in it. So I have http://xxx.yyy.zzz.ttt/mysite/index.php/phpinfo To acces my controller phpinfo instead of http://xxx.yyy.zzz.ttt/mysite/phpinfo I have cheked well that mod_revrite

Codeigniter call Function in Controller without index.php

孤者浪人 提交于 2020-01-06 19:58:54
问题 I know there are so many posts concering that problem. I tried everything, but without success. I use xampp v3.2.2 on my windows 10 machine. In my htdocs I got a project called mysite. In there I have codeigniter 3.0.3. config.php $config['base_url'] = 'http://localhost/mysite/'; $config['index_page'] = ''; routes.php $route['default_controller'] = 'CI_home'; Controller CI_home.php: class CI_home extends CI_Controller{ function __construct() { parent::__construct(); } public function index(

Redirect URLS with Apache mod_rewrite

扶醉桌前 提交于 2020-01-06 19:28:16
问题 I'm trying to redirecting URLS received on my Apache web server. Basically when I type localhost/index.html I want the website to redirect me to a readme.html file inside the htdocs . index.html and readme.html files both are saved in the htdocs . I looked at the Apache documentation but I cannot seem to get this working. Below I have included the code I have wrote so far inside the httpd.conf file. DocumentRoot "usr/local/apache2/htdocs" <Directory "/htdocs"> Options FollowSymLinks

Match last occurence of 4 digits htaccess rewrite

只谈情不闲聊 提交于 2020-01-06 19:23:31
问题 I'm wondering what sort of regex I could use to match the last occurence of a set of 4 digits in my url. My url is being formatted like this /ARTIST/ALBUM-4 DIGITS-EXTRA STUFF In the url, "4 DIGITS" will be the last possible occurence of 4 digits together. The thing is the ALBUM may contain sets of 4 digits, so it needs to match the last occurrence in the url. Basically I need my rewrite rule to act as follows RewriteRule ^(.*)/(.*)-(.* MATCH LAST OCCURENCE OF 4 DIGITS)-(.*)?$ album.php

.htaccess redirect .html to non .html not working

人盡茶涼 提交于 2020-01-06 18:40:24
问题 using this in my .htaccess: RewriteCond %{THE_REQUEST} \.html RewriteRule ^(.*)\.html$ /$1 [R=301,L] But the site is displaying a 404 Not Found, even though I have the file. The file is ishared.html. The redirect works, but it takes to a not found, if you go to http://headupshouldersback.com/ishared.html Any tips? Thanks! EDIT: The following gave me 500 server error on my site: RewriteCond %{THE_REQUEST} \.html RewriteRule ^(.*)\.html$ /$1 [R=301,L] RewriteRule ^(.*) /$1.html [QSA,L] 回答1:

URL rewrite doesn't work in a Symfony2

戏子无情 提交于 2020-01-06 18:07:13
问题 I have a web site under Symfony 2 and want to have a basic URL rewrite. Apache mod rewrite is enabled. Apache has been restarted multiple times. # a2enmod rewrite Module rewrite already enabled Virtual host seems ok <VirtualHost *:80> ServerName mydomain.com ServerAlias www.mydomain.com DocumentRoot /home/www/mydomain/web <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/www/mydomain/web> Options Indexes FollowSymLinks MultiViews AllowOverride None Order

URL rewrite doesn't work in a Symfony2

ⅰ亾dé卋堺 提交于 2020-01-06 18:07:06
问题 I have a web site under Symfony 2 and want to have a basic URL rewrite. Apache mod rewrite is enabled. Apache has been restarted multiple times. # a2enmod rewrite Module rewrite already enabled Virtual host seems ok <VirtualHost *:80> ServerName mydomain.com ServerAlias www.mydomain.com DocumentRoot /home/www/mydomain/web <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/www/mydomain/web> Options Indexes FollowSymLinks MultiViews AllowOverride None Order

Apache - Rewrite dynamic subdomains and URL parameters

蓝咒 提交于 2020-01-06 18:06:33
问题 I have a problem with rewrite condition and rule in Apache2. I want to have dynamic subdomains and dynamic folders, which will rewrite to php script. For example: sub1.example.com/folder1 => do.php?a=sub1&b=folder1 sub2.example.com/folder2 => do.php?a=sub1&b=folder2 It will looks like every subdomain has own folders. But some subdomain (admin etc) will not be rewrited. I know how to rewrite subdomain: RewriteEngine On RewriteCond %{HTTP_HOST} ^(^.*)\.example.com/ [NC] RewriteRule ^(.*)$ do