Note that there are some explanatory texts on larger screens.

plurals
  1. PORemoving .php extension and "?id=xyz"
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/14445077/removing-php-extension-in-urls">Removing .php extension in URLs</a> </p> </blockquote> <p>I've changed the sub-directory of my <code>public_html</code> to act as the main-directory. Currently, <code>mysite.com/alpha/index.php</code> redirects as <code>mysite.com</code>. This is working perfectly.</p> <p>Similarly, I have another file <code>events.php</code>, i.e., <code>mysite.com/alpha/events.php?eventid=10</code> corresponds to <code>mysite.com/events.php?eventid=10</code></p> <p>But, I wanted to access the above path as <code>mysite.com/events/10/</code> instead of <code>mysite.com/events.php?eventid=10</code>. For this I again modified the file, but it fails to load the <code>dynamic URLs</code>. For example, when I hover my mouse on links, it shows </p> <pre><code>`mysite.com/events/14` `mysite.com/events/15` `mysite.com/events/16` `mysite.com/events/17` </code></pre> <p>etc. [which is what I want] But on clicking it [If I click on the link that showed <code>mysite.com/events/14</code> on hover], it opens a page <code>mydomain.com//alpha/events.php/14/14?eventid=</code> and page fetches nothing from the <code>sql</code> tables.</p> <p>My .htaccess file:</p> <pre><code># .htaccess main domain to subdirectory redirect # Copy and paste the following code into the .htaccess file # in the public_html folder of your hosting account # make the changes to the file according to the instructions. # Do not change this line. RewriteEngine on RewriteRule ^([A-Za-z0-9\-]+)/([0-9]+)/?$ $1.php?eventid=$3 # Change example.com to be your main domain. RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$ # Change 'subdirectory' to be the directory you will use for your main domain. RewriteCond %{REQUEST_URI} !^/alpha/ # Don't change these line.' RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Change 'subdirectory' to be the directory you will use for your main domain. RewriteRule ^(.*)$ /alpha/$1 # Change example.com to be your main domain again. # Change 'subdirectory' to be the directory you will use for your main domain # followed by / then the main file for your site, index.php, index.html, etc. RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$ RewriteRule ^(/)?$ alpha/index.php [L] RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] </code></pre>
    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.
 

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