iczc / phurl

phurl短网址
2 stars 1 forks source link

Redirect HTTP 404 error #139

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.create alias at abmc.tk for the domain aubernet.com
2.visit generated URL abmc.tk/t

What is the expected output? What do you see instead?
Expected output is aubernet.com

actual output is a HTTP 404 error

What version of the product are you using? On what operating system?
phurl 2.4.2
OS: CentOS Linux 6.2 64bit
Apache: 2.2.15
mysql: 5.1.61

Please provide any additional information below.
.htaccess file:
<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteOptions MaxRedirects=1
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^([a-zA-Z0-9_-]+)$ redirect.php?alias=$1 [L]
</IfModule>

visiting http://abmc.tk/redirect.php?alias=t will visit the correct url

Original issue reported on code.google.com by webmaste...@gtempaccount.com on 13 Jul 2012 at 6:18

GoogleCodeExporter commented 9 years ago
My installation is also doing this.  

Original comment by peoriapi...@gmail.com on 12 Oct 2012 at 4:19

GoogleCodeExporter commented 9 years ago
I fixed this by adding the subfolder before redirect.php?alias=$1 [L]

Hope this helps!

Original comment by peoriapi...@gmail.com on 12 Oct 2012 at 4:23

GoogleCodeExporter commented 9 years ago
Try visiting http://yourshort.domain/redirect.php?alias=yourCreatedAlias
If this jumps, then php might not be rewriting properly.

Try:
1. vi /etc/httpd/conf/httpd.conf
Find this line:
LoadModule rewrite_module modules/mod_rewrite.so
If there's a # before it, then uncomment it. If this line doesn't exist, add it 
to LoadModule cluster.
Restart httpd.

2. Now use phpinfo() and search if there is "mod_rewrite" in Loaded Modules. If 
yes, then this module is properly loaded. If no, then you might need to 
recompile Apache (I don't know).
N.B. To use phpinfo(), you may create a page xxx.php with following content, 
then visit it using your browser:
<?php phpinfo(); ?>

3. [IMP] vi /etc/httpd/conf/httpd.conf
Find this line:
# AllowOverride controls what directives may be placed in .htaccess files.
There should be a line below it:
    AllowOverride None
Change it to:
    AllowOverride All
Finally, restart the httpd.

I guess the 3rd point could be one of the most common causes of 404, because 
"AllowOverride None" is the default setting if you install apache using "yum" 
from epel repo.

Original comment by shenyq.i...@gmail.com on 21 Feb 2013 at 1:06

GoogleCodeExporter commented 9 years ago
sir,my site is not working properly.short urls are redirect to eror page.my 
websit http://banglavasa.tk/url my email bdmail99@yahoo.com

Original comment by saheduli...@gmail.com on 18 Apr 2013 at 6:23

GoogleCodeExporter commented 9 years ago
you should update your htaccess to support for script in subfolders

RewriteBase / to RewriteBase /your_sub_folder/

Original comment by manis...@gmail.com on 13 Jul 2013 at 1:06