Any one can give a hand figure it out were is my errror in my clean url.
This code is on my vhost and it's not working as I expected. I have try to rewrite
the code and put in .htaccess file and still is not working.

RewriteEngine On
    RewriteCond  %{SERVER_PORT} 80 [OR]
    RewriteCond  %{SERVER_PORT} 8080
    RewriteRule ^(.*)$ https://website.com/ [R=301,L]

    Alias /success "/var/www/html/success.php"
    Alias /alreadyregistered "/var/www/html/alreadyregistered.php"
    Alias /checkpassword "/var/www/html/checkpassword.php"
    Alias /duplicate "/var/www/html/duplicate.php"
    Alias /invaliduser "/var/www/html/invaliduser.php"


This is my new rewrite code I had put on my .htaccess. Can anyone help me what I'm doing wrong here. The alias is notworking at all it's not pulling any .php page  as you see in the alias above code. I'll apreaciated your help in advanced. 

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php 

Thanks,
Toldav

Recommended Answers

All 6 Replies

Member Avatar for LastMitch

This is my new rewrite code I had put on my .htaccess. Can anyone help me what I'm doing wrong here. The alias is notworking at all it's not pulling any .php page as you see in the alias above code. I'll apreaciated your help in advanced.

@Toldav

I want to know do you understand the purpose of using a alias?

If not, let me explain this to you.

If you put an alias on htaccess file it's like a security blanket.

An alias is often used with a cgi-bin or other sensitive directory for added security.

Why so many alias? 1 alias to protect the www path is not enough but 5?

What are you trying to protect that require 5 alias?

Daniweb has 1,089,280 Community Members on the website. Now that require a few alias but in your case do you have that many members?

If you put an alias on htaccess file it's like a security blanket

Could you explain this? :) And also why a website with more members could use more aliases?

@toldav:
Did you know that you can read a URI with PHP as well? Try $_SERVER['REQUEST_URI']. If you redirect all your users to an index.php page for example, you can use $_SERVER['REQUEST_URI'] to read the URI string and, for example, redirect him to another page according to the information in the URI string.

commented: very constructive! +12

I also think $_SERVER['REQUEST_URI'] is a lot nicer thing to do. Most frameworks uses this approach that is why there is no big chunk of .htaccess file in CI but deny from all.

Member Avatar for LastMitch

Could you explain this? :) And also why a website with more members could use more aliases?

@minitauros

Have you seen the TV show called Alias.The way that toldav post his code is like he's trying to hide something, or very suspicious. For me line 6 to line 10 was funny when I first saw it it remind of that TV show.

but on a good note I like the

 $_SERVER['REQUEST_URI']

approached.

@toldav

I got no idea what is your file setting but to explain how it looks it should look like an array but because since you have 5 php files. I'm using one file link:

<?php

$alias = http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

echo $alias;

?>

If you have more questions ask minitauros & veedeoo

@toldav the main problem is that this directive cannot be used inside the .htaccess file, you have to place it in the configuration file, check this for more information:

http://httpd.apache.org/docs/2.2/mod/mod_alias.html#alias

Have you seen the TV show called Alias.The way that toldav post his code is like he's trying to hide something, or very suspicious. For me line 6 to line 10 was funny when I first saw it it remind of that TV show.

Nope I haven't, but I do understand what you mean though ;). I was actually more curious for an answer to why a large website is more likely to need/use more aliases!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.