Note that there are some explanatory texts on larger screens.

plurals
  1. PORewrite URL using PHP
    primarykey
    data
    text
    <p>Following is the Folder Structure of my PHP Project</p> <pre><code>PHPProject (Root) --&gt;Admin/ --&gt;Config/ --&gt;File1.php --&gt;File2.php --&gt; .. --&gt; .. --&gt;.htaccess --&gt;File10.php </code></pre> <p>I would like to enable RewriteURL for the project that can be accessed in the following manner.</p> <p><strong>Rule 1:</strong> My Domain should always be accessed with www.mydomain.com. If someone tries to access as <code>http://mydomain.com</code> i will have to rewrite the URL to <code>http://www.mydomain.com</code>. For which I am using the following rule on my htaccess</p> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / #RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC] #RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301] &lt;/IfModule&gt; </code></pre> <p><strong>Rule 2:</strong> I would like to have a specific URL that points to a page:</p> <p><code>http://www.mydomain.com/username</code> to rewrite to <code>http://www.mydomain.com/file4.php?name=username</code></p> <p><strong>Rule 3:</strong></p> <p>I am able to get the first rule to work properly with the above information on .htaccess file, but the problem is I have to hardcode the domain name on it. Would it be possible to specify a generic (regex) so that the rule applies to multiple domain?</p> <p><strong>Question:</strong> I require help to combine Rule 1 + Rule 2 + Rule 3 altogether as rules on my .htaccess file. </p> <p>Could someone please help me acheive this.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload